#32792 closed Bug (duplicate)
admin.display decorator boolean flag not working with @property
Reported by: | Ronny Vedrilla | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 3.2 |
Severity: | Normal | Keywords: | |
Cc: | pope1ni | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi guys,
I really hope that I'm not missing anything.
I have a model with a boolean property I'd like to show in my admin list view:
class MyModel(models.Model): .... @property @admin.display(description=_('Is external'), boolean=True) def is_external(self): return bool(self.requested_external)
My admin column shows True and False strings instead of the green and red icons.
When I remove the property decorator, it works as expected.
I double-checked the docs but couldn't find any note about not using it with properties.
Thanks!
Attachments (1)
Change History (3)
by , 4 years ago
Attachment: | admin_column.png added |
---|
comment:1 by , 4 years ago
Cc: | added |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
comment:2 by , 4 years ago
Ok, I searched the database for django 3.2 issues (because the decorator was added there - thats why I didnt find it. Sorry.
Note:
See TracTickets
for help on using tickets.
Yes,
boolean
doesn't work for properties. It's a duplicate of #31558.