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'.
Groups are a means of categorizing users. This allows for granting permissions to a specific group.
Django does provide groups and permissions option but this is a model or table level and not at the object level. Hence we decided on creating groups based on the objects on which we want to provide the access and the users were added to these groups as per requirement or based on the existing state of an object.
You can do it using django-modeladmin-reorder.
You'd configure it somehow along these lines then (settings.py):
ADMIN_REORDER = (
{'app': 'requests', 'label': 'Types',
'models': (
'requests.Divisions',
'requests.HardwareRequests',
'requests.HardwareTypes'
)
},
{'app': 'requests', 'label': 'Other models',
'models': (
'requests.Requests',
'requests.SoftwareRequests',
'requests.SoftwareTypes'
)
},
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With