[Fixed]-Group models in django admin

9👍

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.

14👍

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'
        )
   },
)
👤jox

Leave a comment