Lenate John
Lenate John

Reputation: 41

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

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

Upvotes: 1

Views: 260

Answers (2)

Svestis
Svestis

Reputation: 353

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.

Upvotes: 0

Anoop
Anoop

Reputation: 543

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

Upvotes: 1

Related Questions