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.
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>
* 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>
* owner: nobody => Paulo
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/29835#comment:3>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/29835#comment:4>
* owner: Paulo => Hasan Ramezani
--
Ticket URL: <https://code.djangoproject.com/ticket/29835#comment:5>
* 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>
--
Ticket URL: <https://code.djangoproject.com/ticket/29835#comment:7>