我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用django.contrib.admin.autodiscover()。
def make_site(): admin.autodiscover() # now kill off autodiscover since it would reset the registry admin.autodiscover = lambda: None site = RestrictiveAdminSite() # copy over the autodiscovery site._registry = copy(admin.site._registry) # clear the default site registry to avoid leaking an insecure admin admin.site._registry = {} # rebind our admin site to maintain compatibility admin.site = site return site
def ready(self): super(DjangoDatawatchConfig, self).ready() datawatch.autodiscover_checks() admin.autodiscover()
def test_admin(self): admin.autodiscover()
def get_admin(self): admin.autodiscover() return admin.site._registry[Example1]
def get_charpk_example_admin(self): admin.autodiscover() return admin.site._registry[CharPksExample]
def get_admin(self): admin.autodiscover() return admin.site._registry[CharPksExample]
def get_example_admin(self): admin.autodiscover() return admin.site._registry[Example1]
def get_page_admin(self): admin.autodiscover() return admin.site._registry[Page]