Opened 12 years ago

Closed 12 years ago

#19084 closed Uncategorized (wontfix)

Allow sorting by PK in admin

Reported by: Ram Rachum 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

Description

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 by Aymeric Augustin, 12 years ago

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 _meta.pk.attname. 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