Removing 'Sites' from Django admin page

前端 未结 2 1152
既然无缘
既然无缘 2020-12-24 07:24

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.

相关标签:
2条回答
  • 2020-12-24 08:08

    Perhaps commenting out django.contrib.sites from the INSTALLED_APPS tuple in your settings.py file will help.

    0 讨论(0)
  • 2020-12-24 08:16

    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

    0 讨论(0)
提交回复
热议问题