[Django] #32792: admin.display decorator boolean flag not working with @property

32 views
Skip to first unread message

Django

unread,
May 27, 2021, 6:15:35 AM5/27/21
to django-...@googlegroups.com
#32792: admin.display decorator boolean flag not working with @property
-----------------------------------------+------------------------
Reporter: Ron | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
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!

--
Ticket URL: <https://code.djangoproject.com/ticket/32792>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 27, 2021, 6:15:55 AM5/27/21
to django-...@googlegroups.com
#32792: admin.display decorator boolean flag not working with @property
-------------------------------+--------------------------------------

Reporter: Ron | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 3.2
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Ron):

* Attachment "admin_column.png" added.

Django

unread,
May 27, 2021, 7:42:35 AM5/27/21
to django-...@googlegroups.com
#32792: admin.display decorator boolean flag not working with @property
-------------------------------+--------------------------------------
Reporter: Ron | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 3.2
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* cc: Nick Pope (added)
* status: new => closed
* resolution: => duplicate


Comment:

Yes, `boolean` doesn't work for properties. It's a duplicate of #31558.

--
Ticket URL: <https://code.djangoproject.com/ticket/32792#comment:1>

Django

unread,
May 28, 2021, 8:52:57 AM5/28/21
to django-...@googlegroups.com
#32792: admin.display decorator boolean flag not working with @property
-------------------------------+--------------------------------------
Reporter: Ron | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 3.2
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Ron):

Ok, I searched the database for django 3.2 issues (because the decorator
was added there - thats why I didnt find it. Sorry.

--
Ticket URL: <https://code.djangoproject.com/ticket/32792#comment:2>

Reply all
Reply to author
Forward
0 new messages