Need to group the apps under labels for the sidebar of django admin using the package jazzmin

116 Views Asked by At

I have managed to group the apps in the landaing page of dashboard. But in side bar it was not refelcting. i need to group the models in the side bar too.

i have used the jazzmin package as well as the admin_reorder

packages used are :- django-modeladmin-reorder==0.3.1 and django-reorder-admin==0.3.1

2

There are 2 best solutions below

1
Anoop On BEST ANSWER

Create a custom middleware and add it in your settings file.

from admin_reorder.middleware import ModelAdminReorder


class ModelAdminReorderWithNav(ModelAdminReorder):

    def process_template_response(self, request, response):

        available_apps = response.context_data.get('available_apps')

        response.context_data['app_list'] = available_apps

        response = super().process_template_response(request, response)

        response.context_data['available_apps'] = response.context_data[

            'app_list'

        ]

        return response
0
Svestis On

There is an issue with the current reorder package - it looks like it is not maintained. I had exactly the same issue but I found that a PR exists, that solves this issue.

You can navigate to the issue and fetch the lib through a github repo, instead of using it directly under the package name.

Hope it helps.