[Django] #29835: list_filter does not follow admin ordering, only model meta

7 views
Skip to first unread message

Django

unread,
Oct 10, 2018, 3:40:03 AM10/10/18
to django-...@googlegroups.com
#29835: list_filter does not follow admin ordering, only model meta
-----------------------------------------------+------------------------
Reporter: Brillgen Developers | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.0
Severity: Normal | Keywords: filter
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------------+------------------------
Django admin class provides an ordering field which overrides (or defines)
the order in which objects should be displayed. This is respected by the
new autocomplete field also in foreign keys.

However the django admin list filter does not use the ordering from the
related admin (if present) and only relies on the model meta ordering.
This has a performance impact also as the model meta ordering applies to
all queries, not just those for django admin.

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

Django

unread,
Oct 10, 2018, 3:41:02 AM10/10/18
to django-...@googlegroups.com
#29835: list_filter does not follow admin ordering, only model meta
-------------------------------------+-------------------------------------

Reporter: Brillgen Developers | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.0
Severity: Normal | Resolution:

Keywords: filter | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Brillgen Developers:

Old description:

> Django admin class provides an ordering field which overrides (or
> defines) the order in which objects should be displayed. This is
> respected by the new autocomplete field also in foreign keys.
>
> However the django admin list filter does not use the ordering from the
> related admin (if present) and only relies on the model meta ordering.
> This has a performance impact also as the model meta ordering applies to
> all queries, not just those for django admin.

New description:

Django admin class provides an ordering field which overrides the model
meta ordering/defines the order in which objects should be displayed. This
is respected by the new autocomplete field in foreign keys.

However the django admin list filter does not use the ordering from the
related admin (if present) and only relies on the model meta ordering.
This has a performance impact also as the model meta ordering applies to
all queries, not just those for django admin.

--

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

Django

unread,
Oct 10, 2018, 7:28:45 AM10/10/18
to django-...@googlegroups.com
#29835: list_filter does not follow admin ordering, only model meta
-------------------------------------+------------------------------------

Reporter: Brillgen Developers | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: filter | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Carlton Gibson):

* version: 2.0 => master
* stage: Unreviewed => Accepted


Comment:

This looks reasonable.
[https://github.com/django/django/blob/f3d3338e06d571a529bb2046428eeac8e56bcbf6/django/contrib/admin/filters.py#L196-L197
`RelatedFieldListFilter.field_choices()`] goes straight via
[https://github.com/django/django/blob/f3d3338e06d571a529bb2046428eeac8e56bcbf6/django/db/models/fields/__init__.py#L810-L832
`Field.get_choices()`]. It should probably make a detour through
[https://github.com/django/django/blob/f3d3338e06d571a529bb2046428eeac8e56bcbf6/django/contrib/admin/options.py#L208-L219
`BaseModelAdmin.get_field_queryset()`].

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

Django

unread,
Oct 14, 2018, 2:49:21 PM10/14/18
to django-...@googlegroups.com
#29835: list_filter does not follow admin ordering, only model meta
-------------------------------------+------------------------------------
Reporter: Brillgen Developers | Owner: Paulo
Type: Bug | Status: assigned

Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: filter | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Paulo):

* owner: nobody => Paulo
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/29835#comment:3>

Django

unread,
Oct 25, 2018, 3:20:56 AM10/25/18
to django-...@googlegroups.com
#29835: list_filter does not follow admin ordering, only model meta
-------------------------------------+------------------------------------
Reporter: Brillgen Developers | Owner: Paulo
Type: Bug | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: filter | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Hasan Ramezani):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/29835#comment:4>

Django

unread,
Oct 25, 2018, 3:45:02 AM10/25/18
to django-...@googlegroups.com
#29835: list_filter does not follow admin ordering, only model meta
-------------------------------------+-------------------------------------
Reporter: Brillgen Developers | Owner: Hasan
| Ramezani

Type: Bug | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: filter | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* owner: Paulo => Hasan Ramezani


--
Ticket URL: <https://code.djangoproject.com/ticket/29835#comment:5>

Django

unread,
Nov 14, 2018, 2:58:26 PM11/14/18
to django-...@googlegroups.com
#29835: list_filter does not follow admin ordering, only model meta
-------------------------------------+-------------------------------------
Reporter: Brillgen Developers | Owner: Hasan
| Ramezani
Type: Bug | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

Keywords: filter | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"6d4e5feb79f7eabe8a0c7c4b87f25b1a7f87ca0b" 6d4e5fe]:
{{{
#!CommitTicketReference repository=""
revision="6d4e5feb79f7eabe8a0c7c4b87f25b1a7f87ca0b"
Fixed #29835 -- Made RelatedFieldListFilter respect ModelAdmin.ordering.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29835#comment:6>

Django

unread,
Nov 14, 2018, 2:58:53 PM11/14/18
to django-...@googlegroups.com
#29835: Make RelatedFieldListFilter respect ModelAdmin.ordering

-------------------------------------+-------------------------------------
Reporter: Brillgen Developers | Owner: Hasan
| Ramezani
Type: Bug | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed
Keywords: filter | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/29835#comment:7>

Reply all
Reply to author
Forward
0 new messages