Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 653
atropa belladona Avatar asked Oct 27 '25 05:10

atropa belladona


2 Answers

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.

like image 132
Alexi Reveal Avatar answered Oct 28 '25 18:10

Alexi Reveal


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

like image 43
ilyasbbu Avatar answered Oct 28 '25 20:10

ilyasbbu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!