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: |
Description
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)
Change History (9)
comment:1 Changed 13 years ago by
Owner: | changed from nobody to Badri |
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
Changed 13 years ago by
comment:2 Changed 13 years ago by
Has patch: | set |
---|
comment:3 Changed 13 years ago by
Needs documentation: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
Triage Stage: | Accepted → Design decision needed |
comment:4 Changed 13 years ago by
Triage Stage: | Design decision needed → Unreviewed |
---|
See also #7497 for a related proposal/discussion.
comment:5 Changed 13 years ago by
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:6 Changed 13 years ago by
If I'm not mistaken, at the moment the ordering depends on the order in which the models are defined in your models.py 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 models.py, 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
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
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
Duplicate of #7497.
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 admin.py 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
app 2
where the number is value of the index property