Hide Auth section in Django Admin [duplicate]

2019-03-17 10:02发布

问题:

This question already has an answer here:

  • Remove default apps from Django-admin 3 answers

In the Django Admin, is there any way to hide the "Auth" section? Assuming this is a clean installation of Django and barebones project with no apps, only admin.

回答1:

You can use admin.site.unregister

from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.contrib.auth.models import Group

admin.site.unregister(User)
admin.site.unregister(Group)
admin.site.unregister(Site)