From e1790f77dcf03f7270b297d09aded7649f87b0c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iva=CC=81n=20Raskovsky?= Date: Thu, 26 Feb 2026 01:56:44 +0000 Subject: [PATCH] Fix Django 6 format_html error in Alert admin Django 6 requires args/kwargs in format_html(). Switch to mark_safe() for static HTML strings in get_status display method. --- backend/contributions/admin.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/contributions/admin.py b/backend/contributions/admin.py index 846844e..4f227ca 100644 --- a/backend/contributions/admin.py +++ b/backend/contributions/admin.py @@ -733,12 +733,13 @@ def text_preview(self, obj): def get_status(self, obj): from django.utils import timezone as tz + from django.utils.safestring import mark_safe now = tz.now() if not obj.is_active: - return format_html(' Inactive') + return mark_safe(' Inactive') if obj.start_date and now < obj.start_date: - return format_html(' Scheduled') + return mark_safe(' Scheduled') if obj.end_date and now > obj.end_date: - return format_html(' Expired') - return format_html(' Active') + return mark_safe(' Expired') + return mark_safe(' Active') get_status.short_description = 'Status'