#18086 closed Cleanup/optimization (fixed)
Restore '-pk' as the default order in admin changelist
Reported by: | Julien Phalip | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.4 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | yes |
Description
Until Django 1.3, the admin changelist's default order was '-pk': https://code.djangoproject.com/browser/django/branches/releases/1.3.X/django/contrib/admin/views/main.py#L146
As some point in the 1.4 release cycle (probably when multi-sort was enabled) the default order was dropped, which caused the non-deterministic order issue in #17198. That ticket was fixed by re-introducing the primary key in the list of ordering fields to enforce a deterministic order (in all cases, not just for the default order) in r17635.
Now everything works fine, however the default order is 'pk'. Partially for backwards compatibility, but primarily for a better user experience, I think we should restore '-pk' as the default order. The main reason is that one usually care more about the most recent items, so it's generally best if those appear at the top of the first page of the changelist.
The attached patch does just that. I suggest also porting it to 1.4.X for backwards compatibility.
Attachments (1)
Change History (7)
by , 13 years ago
Attachment: | 18086.admin-changelist-order-pk-desc.diff added |
---|
comment:1 by , 13 years ago
Has patch: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 13 years ago
If this is applied then we should back-patch this as a fix to a regression in 1.4. Having it different in 1.3 than 1.4 and again different in 1.5 doesn't sound like a good idea.
I quickly looked through the patch and found no problems. The full test suite passes on SQLite. So, fine for me too.
comment:3 by , 13 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:4 by , 13 years ago
@akaariai: Yes that's what I suggested above. It's a minor "regression" (or rather an uncontroversial change in behavior :-), which I too think should be corrected in 1.4.1. I'll push the patch to the 2 branches.
Fine for me.