Opened 5 years ago

Closed 5 years ago

#31452 closed New feature (duplicate)

Allow to order models in the admin index and app index views

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

Description

We should allow to display the models in a specific order per app on the admin index and the app index. Suggestion is to add a new order_in_index option on ModelAdmin.

When left to default (None), the models are sorted alphabetically (backwards compatible).

This helps deal with a common case where there is some logical order between models that does not match alphabetical order (e.g. Continents, Countries, Counties, Cities is much more usable than Cities, Continents, Counties, Countries). There is no easy way to achieve this, except by prepending verbose_name with spaces, which is not very elegant.

This of course adds yet one more configuration to ModelAdmin, but both the implementation and usage are reasonably simple compared to the readability benefit they offer.

This doesn't tackle the ordering of apps themselves, which would be nice too but is another issue.

Change History (2)

comment:2 by Olivier Dalang, 5 years ago

Resolution: duplicate
Status: newclosed

Duplicates https://code.djangoproject.com/ticket/25671 (sorry didn't find it)

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