Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing 'Sites' from Django admin page

Tags:

The Django admin page has 'Sites' as a default object.

This is confusing to users, as my application also has a 'Site' model accessible through the admin page.

How can I remove the default object from the page?

like image 844
meepmeep Avatar asked Apr 21 '11 09:04

meepmeep


People also ask

Can we customize Django admin panel?

The Django admin is a powerful built-in tool giving you the ability to create, update, and delete objects in your database using a web interface. You can customize the Django admin to do almost anything you want.

How can I remove extra's from Django admin panel?

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.

How do I unregister a Django model?

You can unregister default models in admin.py of your app by using unregister . You need to import Attachment from summernote to works.

Where is admin site urls in Django?

If you open a Django project's urls.py file, in the urlpatterns variable you'll see the line path('admin/', admin. site. urls) . This last path definition tells Django to enable the admin site app on the /admin/ url directory (e.g. http://127.0.0.1:8000/admin/ ).


1 Answers

use unregister:

from django.contrib import admin from django.contrib.sites.models import Site  admin.site.unregister(Site) 

I usually put this after the:

admin.autodiscover() 

in urls.py

like image 81
dting Avatar answered Oct 06 '22 05:10

dting