我一直很好奇
admin.autodiscover()
事实上是这样。The document没怎么说:
Above we used admin.autodiscover() to automatically load the INSTALLED_APPS admin.py modules.
以及
There is really no need to use autodiscover when using your own AdminSite instance since you will likely be importing all the per-app admin.py modules in your myproject.admin module.
如果我不忘记
^{pr2}$我会失去什么功能?在
为了什么考虑我应该使用还是不使用autodiscover
?在
正如您所说:autodiscover()加载所有管理员py从应用程序文件夹。所以你在/admin/中有你使用的所有模型(不管是否来自你自己的应用程序)。在
如果要使用管理应用程序,我建议使用autodiscover()。在
另外,有些应用程序的自动发现功能更多。在
相关问题 更多 >
编程相关推荐