[Django] #30354: Filter not displayed when admin.RelatedOnlyFieldListFilter is used for auth.models.User

20 views
Skip to first unread message

Django

unread,
Apr 11, 2019, 5:46:18 PM4/11/19
to django-...@googlegroups.com
#30354: Filter not displayed when admin.RelatedOnlyFieldListFilter is used for
auth.models.User
-----------------------------------------+------------------------
Reporter: rvernica | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.1
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 |
-----------------------------------------+------------------------
In a model where a field is a foreign keys to `auth.models.User`,
`admin.RelatedOnlyFieldListFilter` does not display a filter. Something
like:
{{{
class Foo(models.Model):
bar = models.ForeignKey(auth.models.User, on_delete=models.CASCADE)
}}}
And `ModelAdmin` uses `RelatedOnlyFieldListFilter` for the foreign key:
{{{
class FooAdmin(admin.ModelAdmin):
list_display = ('bar',)
list_filter = (('bar', admin.RelatedOnlyFieldListFilter),)
}}}
No filter is displayed in the UI in the right side-bar. No error message
is displayed. If `list_filter` is changed to:
{{{
list_filter = ('bar',)
}}}
It works as expected.

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

Django

unread,
Apr 19, 2019, 5:38:31 AM4/19/19
to django-...@googlegroups.com
#30354: Filter not displayed when admin.RelatedOnlyFieldListFilter is used for
auth.models.User
-------------------------------+--------------------------------------
Reporter: rvernica | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: master
Severity: Normal | Resolution: worksforme

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 felixxm):

* status: new => closed
* version: 2.1 => master
* resolution: => worksforme


Comment:

Everything works for me on the current master (checked at
49fb3f5f3ed8b37f2ae02d0fdc6980c4152c58e3). Maybe you have only one user
related with `Foo`. List filter with only one value will not be displayed.

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

Reply all
Reply to author
Forward
0 new messages