Opened 4 years ago

Closed 4 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 4 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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