Anton Koval' Anton Koval' - 1 month ago 14
Python Question

Remove default apps from Django-admin

By default, in Django-admin there is Users, Groups, and Sites apps. How can I remove Groups and Sites?

I tried to remove

admin.autodiscover()
from root urls. Then, when I added something like
admin.site.register(User, UserAdmin)
somewhere in my app models I got an
AlreadyRegistered
exception (this is fairly right - models users already registered in django.contrib.auth).

Answer Source

In an admin.py you know will definitely be loaded, try:

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