Home > Blockchain >  How to Change order of Modules listed in Side Bar of Django Admin
How to Change order of Modules listed in Side Bar of Django Admin

Time:08-31

See here are some modules in alphabetical order by default in the admin sidebar

Authentication and Authorization Data/Questions/Surveys/Website admin

enter image description here

I want to rearrange the order how can I do that. ? I know in the Django world it does not matter. But our client requested to do that. So we need help with how we can do that.

CodePudding user response:

Two steps necessary to override the default ordering for your admin site.

First would be subclassing Django's built in AdminSite. This will allow you to customize your app list as you see fit.

Specifically you will want to look to override the get_app_list method for your AdminSite subclass.

per Django Docs on AdminSite.get_app_list method:

Lists of applications and models are sorted alphabetically by their names. You can override this method to change the default order on the admin index page.

CodePudding user response:

There is is a pip package for it django-reorder-admin. There is a full guide on how to use it in the documentation.

  • Related