Restore '-pk' as the default order in admin changelist
|Reported by:||julien||Owned by:||nobody|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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.
Change History (7)
Changed 2 years ago by julien
comment:1 Changed 2 years ago by claudep
- Has patch set
- Triage Stage changed from Unreviewed to Accepted