set color for status incomplete

This commit is contained in:
2023-10-27 09:44:03 +00:00
parent 1c6c850689
commit 082ad8f0b9

View File

@@ -173,10 +173,12 @@ class BillAdmin(admin.ModelAdmin):
get_bankdata_bic.short_description = "BIC" get_bankdata_bic.short_description = "BIC"
def status_colored(self, obj): def status_colored(self, obj):
# TODO: if there is a status without color, set nothing.
colors = { colors = {
"S": "red", "S": "red",
"C": "darkorange", "C": "darkorange",
"F": "green", "F": "green",
"I": "blue",
} }
return mark_safe( return mark_safe(
f'<b style="background:{colors[obj.status]};">{obj.get_status_display()}</b>' f'<b style="background:{colors[obj.status]};">{obj.get_status_display()}</b>'