A
A
Alexander Vinogradov2017-03-02 10:45:02
Django
Alexander Vinogradov, 2017-03-02 10:45:02

How to categorize in the admin panel in one application?

When we add model classes to the admin panel, then all of them are displayed on the admin page in one block of their application, for example, see the figure
92d8e618de514716a97b3467628765bb.png
Is it possible to divide items into groups using standard tools so that they are displayed in different blocks? For example, block "MAIN" and block "MAIN settings"?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artyom Bryukhanov, 2017-03-02
@drupa

https://github.com/mishbahr/django-modeladmin-reorder

ADMIN_REORDER = (
    # Keep original label and models
    'sites',

    # Rename app
    {'app': 'auth', 'label': 'Authorisation'},

    # Reorder app models
    {'app': 'auth', 'models': ('auth.User', 'auth.Group')},

    # Exclude models
    {'app': 'auth', 'models': ('auth.User', )},

    # Cross-linked models
    {'app': 'auth', 'models': ('auth.User', 'sites.Site')},

    # models with custom name
    {'app': 'auth', 'models': (
        'auth.Group',
        {'model': 'auth.User', 'label': 'Staff'},
    )},
)

M
marazmiki, 2017-03-03
@marazmiki

Is it possible to divide items into groups using standard tools so that they are displayed in different blocks? For example, block "MAIN" and block "MAIN settings"?

You can do this with standard tools, but the elegance of the solution is in question. The idea is this:
As a result, we will get a pseudo-model in the second application, which is actually in the first one.
Theoretically, probably, you can even create a proxy model directly in the admin panel of the second application app_2.admin, but I'm not sure here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question