Opened 7 years ago

Closed 7 years ago

#19084 closed Uncategorized (wontfix)

Allow sorting by PK in admin

Reported by: coolRR Owned by: nobody
Component: contrib.admin Version:
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When I make the Django admin show a "PK" column, it doesn't let me sort by that column, despite the fact that it does allow sorting by "ID", which is usually identical.

Please allow sorting by the PK as well.

Change History (1)

comment:1 Changed 7 years ago by Aymeric Augustin

Resolution: wontfix
Status: newclosed

pk is a property on model instances, not a model field.

To enable sorting, we'd have to somehow set pk.admin_order_field to the I don't see how to achieve that — especially since core shouldn't contain code for contrib apps such as the admin.

Just use the real model field!

Note: See TracTickets for help on using tickets.
Back to Top