Opened 16 years ago
Closed 15 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 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
by , 16 years ago
comment:2 by , 16 years ago
Has patch: | set |
---|
comment:3 by , 16 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
Triage Stage: | Accepted → Design decision needed |
comment:4 by , 16 years ago
Triage Stage: | Design decision needed → Unreviewed |
---|
See also #7497 for a related proposal/discussion.
comment:5 by , 16 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:6 by , 15 years ago
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 by , 15 years ago
Cc: | added |
---|
NB. I could well be mistaken about the workaround I suggested. It's based on a very hazy recollection and nothing more.
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