Removing 'Sites' from Django admin page

前端 未结 2 1151
既然无缘
既然无缘 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: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

提交回复
热议问题