#17252: Multi-sort in admin does not respect initial admin_order_field
-------------------------------+-----------------------------------------
Reporter: sebastian | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: SVN
Severity: Normal | Keywords: multi-sort, admin, ordering
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 1 | UI/UX: 1
-------------------------------+-----------------------------------------
The multi-sort addition to the admin change list (introduced in #11868)
fails to set the sort indicators for the default ordering in the following
case: the model admin's `ordering` refers not to a proper field but to the
name of a method with `admin_order_field` set. That method can either be
defined in the model admin or the model itself, it doesn't matter.
The problem is easily fixed by the attached patch. We have to resolve the
name that was given in `list_display` both when applying the actual
ordering, as well as when getting the default ordering in case no explicit
`ORDER_VAR` has yet been passed to the view.
Since the same functionality is required both within method `get_ordering`
and `get_ordering_field_columns`, I moved the shared code to the new
method `_get_admin_order_field` which simply does what the name indicates.
--
Ticket URL: <https://code.djangoproject.com/ticket/17252>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.