从Django管理页面删除“站点” [英] Removing 'Sites' from Django admin page
本文介绍了从Django管理页面删除“站点”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Django管理页面的站点作为默认对象。
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?
推荐答案
使用 注销
:
from django.contrib import admin
from django.contrib.sites.models import Site
admin.site.unregister(Site)
$ b $我通常把这一点放在:
I usually put this after the:
admin.autodiscover()
在urls.py
这篇关于从Django管理页面删除“站点”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文