The Django administration site comes with a couple of default entries, depending on which apps and middleware is installed.
Usually there is at least Users
and Groups
, and if the quite common “allauth” is installed, then there is also Site
, SocialApp
, SocialAccount
, and SocialToken
. They are not always necessary, especially when no Social Login is used. Or why have the “Site” administration when only Site=1
is used?
With a few tricks these can be removed from the admin menu.
For doing that, settings.py
is not the right place - when this file is loaded the app is not yet entirely activated. I picked urls.py
in my application directory.
To deactivate the admin pages it needs two things: import
the module, and unregister
the page:
|
|
That’s it. The 5 pages are no longer shown in the admin menu.