Opened 13 years ago

Closed 13 years ago

#9928 closed (duplicate)

Ordering of admin.ModelAdmin objects in admin site

Reported by: ruiaf Owned by: Badri
Component: contrib.admin Version: 1.0
Severity: Keywords:
Cc: sam.kuper@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: yes
Easy pickings: UI/UX:


Lets say I have my pizza application with Topping and Pizza classes and they show in Django Admin like this:

Toppings Add / Change
Pizzas Add / Change

But it would be nice to have them like this:

Pizzas Add / Change
Toppings Add / Change

Currently there is no way of doing this. It would be nice and I think it is important.

Attachments (1)

9928.diff (2.1 KB) - added by Badri 13 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 13 years ago by Badri

Owner: changed from nobody to Badri
Status: newassigned
Triage Stage: UnreviewedAccepted

Changed 13 years ago by Badri

Attachment: 9928.diff added

comment:2 Changed 13 years ago by Badri

Has patch: set

comment:3 Changed 13 years ago by Mathijs Dumon

Needs documentation: set
Needs tests: set
Patch needs improvement: set
Triage Stage: AcceptedDesign decision needed

I think this should be improved as such that we can set an 'index' field on our ModelAdmin objects and our applications. If it is present this is used for ordering, if not alphabetical ordering is assumed. This index field is trivial for ModelAdmin objects, but for application it should be set inside the file, perhaps like this:


this way users have full control over ordering inside apps and outside apps, eg. the index page would look like:

app 1

model 1
model 3
model 4

app 2

model 1
model 2
model 4
model 5

where the number is value of the index property

comment:4 Changed 13 years ago by Ramiro Morales

Triage Stage: Design decision neededUnreviewed

See also #7497 for a related proposal/discussion.

comment:5 Changed 13 years ago by Jacob

Triage Stage: UnreviewedDesign decision needed

comment:6 Changed 13 years ago by sampablokuper

If I'm not mistaken, at the moment the ordering depends on the order in which the models are defined in your for the app. So by re-ordering them there, you can change the order in which they're shown in the admin.

However, it may not always be possible to place them in the desired order in, for instance if the model you want at the beginning of the list in the admin depends on having something defined by another model in the same app. So although the above workaround will be useful in some cases, a proper fix is still needed.

comment:7 Changed 13 years ago by sampablokuper

Cc: sam.kuper@… added

NB. I could well be mistaken about the workaround I suggested. It's based on a very hazy recollection and nothing more.

comment:8 Changed 13 years ago by Russell Keith-Magee

Resolution: duplicate
Status: assignedclosed

Duplicate of #7497.

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