use format_html instead of mark_safe
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
from django.contrib import admin, messages
|
from django.contrib import admin, messages
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.utils.html import format_html
|
from django.utils.html import format_html
|
||||||
from django.utils.safestring import mark_safe
|
|
||||||
from django.utils.translation import ngettext
|
from django.utils.translation import ngettext
|
||||||
from segno import helpers
|
from segno import helpers
|
||||||
|
|
||||||
@@ -219,7 +218,7 @@ class BillAdmin(admin.ModelAdmin):
|
|||||||
"F": "green",
|
"F": "green",
|
||||||
"I": "blue",
|
"I": "blue",
|
||||||
}
|
}
|
||||||
return mark_safe(
|
return format_html(
|
||||||
f'<b style="background:{colors[obj.status]};">{obj.get_status_display()}</b>'
|
f'<b style="background:{colors[obj.status]};">{obj.get_status_display()}</b>'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user