#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 | Resolution:
Keywords: multi-sort, admin, | Triage Stage: Accepted
ordering | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1
Needs tests: 0 | UI/UX: 1
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Comment (by sebastian):
One final thought regarding your [comment:4 comment]:
> However, I'm not entirely happy with the fix, in particular with the
fact that it makes the `ModelAdmin.ordering` option non explicit. For
example (based on your tests), to sort by a method called `some_order()`,
you have to set `ordering` to `('order',)`.
My patch doesn't change this, I'm simply using the current specification.
Having to set `ordering` explicitly to match the actual model field in
question is and was current behavior with and without my patch. In fact,
the docs for `contrib.admin` explicitly say:
From
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.ordering:
> `ModelAdmin.ordering`: Set `ordering` to specify how lists of objects
should be ordered in the Django admin views. This should be a list or
tuple in the same format as a model's `ordering` parameter.
From
https://docs.djangoproject.com/en/dev/ref/models/options/#django.db.models.Options.ordering:
> `Options.ordering`: The default ordering for the object, for use when
obtaining lists of objects: (…) This is a tuple or list of strings. Each
string is a field name (…)
--
Ticket URL: <https://code.djangoproject.com/ticket/17252#comment:6>
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.