注册的模型不会显示在管理员中 [英] Registered models do not show up in admin
本文介绍了注册的模型不会显示在管理员中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通过 admin.site.register
向管理员添加了一个模型,它不会显示在管理员中。由于管理员是这样只是工作,我不知道如何调试这个。指针?
I added a model to admin via admin.site.register
, and it does not show up in admin. Since admin is so "It just works", I have no idea of how to debug this. Pointers?
推荐答案
添加和注册您的管理员后:
After adding and registering your admin:
# app/admin.py
class YourModelAdmin(admin.ModelAdmin):
pass
admin.site.register(YourModel, YourModelAdmin)
确保您的应用程序位于您的项目 settings.py
:
Make sure your app is in your project settings.py
:
# settings.py
INSTALLED_APPS = (
# other apps ...
'app',
)
如果您没有已经这样做了:
Sync your project for that model if you have not done so already:
python manage.py syncdb
重新启动服务器, CTRL-C
:
python manage.py runserver
这篇关于注册的模型不会显示在管理员中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文