Quantcast
Channel: list_display - boolean icons for methods - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by Denis for list_display - boolean icons for methods

Thanks to @daniel-roseman (rtfm)Since Django 3.2 there is a decorator@admin.display(boolean=True):If the string (in list_display) given is a method of the model,ModelAdmin or a callable that returns...

View Article



Answer by Daniel Roseman for list_display - boolean icons for methods

This is documented, although it's a bit hard to find - go a couple of screens down from here, and you'll find this:If the string given is a method of the model, ModelAdmin or a callable that returns...

View Article

list_display - boolean icons for methods

When defining the list_display array for a ModelAdmin class, if a BooleanField or NullBooleanField is given the UI will use nice looking icons instead of True/False text in the column. If a method that...

View Article

Answer by Shmuelt for list_display - boolean icons for methods

I got this to work for me (Django 3.1.10)class MyAdmin(MyModel): list_display = ("field_as_boolean", ) def field_as_boolean(self, obj): return True if obj.field else False field_as_boolean.boolean =...

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images