views:

353

answers:

1

Is there any way to group the models in django admin interface?

I currently have an app called requests with the following models showing in the admin site:

**Requests**
Divisions
Hardware Requests
Hardware Types
Requests
Software Requests
Software Types

I would like the divisions, Software Requests and Hardware Requests to be grouped separately in a "Types" group. I know I could override and hard code the admin/index.html and base_site.html but this seems rather convoluted just to specify grouping.

Is there anything i can add to the Meta class to specify a group name?

The only way I have found so far to achieve what i want is to move the models to a new app within requests ("requests.Types") but again, doesn't feel like its the 'correct way'.

+3  A: 

There isn't anything you can put in the model definition to do this, because models -- by design -- don't know about the existence of the admin, or how they'll be presented in the admin.

This really is a case where you just write a template that does what you want, and use it; all you're asking for is a presentational change, and templates are where you do presentation in Django.

James Bennett