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).
Take a look at the Model Meta in the django documentation. Within a Model you can add class Meta this allows additional options for your model which handles things like singular and plural naming. Show activity on this post. inside model.py or inside your customized model file add class meta within a Model Class.
Django's Admin is amazing. A built-in and fully functional interface that quickly gets in and allows data entry is priceless. Developers can focus on building additional functionality instead of creating dummy interfaces to interact with the database.
You can unregister default models in admin.py of your app by using unregister .
In an admin.py you know will definitely be loaded, try:
admin.site.unregister(User) admin.site.unregister(Group) admin.site.unregister(Site)
In addition to the above double check your ordering of "INSTALLED_APPS" in "settings.py"
INSTALLED_APPS = [ # django apps first 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', # custom apps below 'my_app' ]
Otherwise it will cause an error. See here: Issue with Django admin registering an inline user profile admin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With