By default, the Django admin dashboard looks like this for me:
I want to change the ordering of models in Profile
section, so by using codes from here and here I was able to change the ordering of model names in Django admin dashboard:
class MyAdminSite(admin.AdminSite):
def get_app_list(self, request):
"""
Return a sorted list of all the installed apps that have been
registered in this site.
"""
ordering = {
"Users": 1,
"Permissions": 2,
"Activities": 3,
}
app_dict = self._build_app_dict(request)
# a.sort(key=lambda x: b.index(x[0]))
# Sort the apps alphabetically.
app_list = sorted(app_dict.values(), key=lambda x: x['name'].lower())
# Sort the models alphabetically within each app.
for app in app_list:
app['models'].sort(key=lambda x: ordering[x['name']])
return app_list
mysite = MyAdminSite()
admin.site = mysite
sites.site = mysite
New look and feel:
But as you see, I have lost the AUTHENTICATION AND AUTHORIZATION
section; What should I do to have all the sections and at the same time have my own custom ordering for Profile
section?