How do I delete the model groups admin page? I want to show that by default, the group model. Thank you very much in advance.
Asked
Active
Viewed 1.9k times
2 Answers
65
Use the unregister
method :
Add to the admin.py file :
from django.contrib import admin
from django.contrib.auth.models import Group
admin.site.unregister(Group)
-
5I'm getting "django.contrib.admin.sites.NotRegistered: The model Group is not registered" – Rishabh Agrahari May 26 '17 at 12:39
-
19So, I was getting that error because `'django.contrib.auth'` was below my app in `INSTALLED_APPS` tuple in `settings.py`, I changed the order, now it works :D – Rishabh Agrahari Jul 18 '17 at 16:40
6
You need to check the order of INSTALLED_APPS
in settings.py
. Basically, your app should be listed after the django.contrib.auth
.
Use the following code to unregister
the Group inside admin.py
file of your app:
from django.contrib.auth.models import User
admin.site.unregister(Group)

Pedram Parsian
- 3,750
- 3
- 19
- 34

Monica Rajmohan
- 79
- 1
- 4
-
Could you further elaborate why the ordering of INSTALLED_APPS caused this problem to take place? – A. Khaled May 21 '21 at 10:28