show “on” or “off” icons for calculated boolean
fields


@admin.register(Hero)
class HeroAdmin(admin.ModelAdmin):
list_display = ("name", "is_immortal", "category", "origin", "is_very_benevolent")
list_filter = ("is_immortal", "category", "origin", IsVeryBenevolentFilter)

def is_very_benevolent(self, obj):
return obj.benevolence_factor > 75

is_very_benevolent.boolean = True
is_very_benevolent.short_description = 'benevolent'



date:Nov. 28, 2023