我正在尝试注册我的模型到wagtail管理员,但我不能看到我的模型。
我的模型是
class Abc(models.Model):
abc_id = models.AutoField(primary_key=True)
type = models.ForeignKey(AbcTypes, models.DO_NOTHING, db_column='type')
name = models.TextField()
country = models.ForeignKey(Countries, models.DO_NOTHING, db_column='country')
active = models.BooleanField()我正在尝试使用wagtail_hook将我的Abc模型注册到wagtail管理员。
wagtail_hooks.py
from wagtail.contrib.modeladmin.options import (
ModelAdmin, modeladmin_register)
from .models import Abc
class AbcWagtailAdmin(ModelAdmin):
model = Abc
menu_label = 'Abc Data' # ditch this to use verbose_name_plural from model
menu_icon = 'tag' # change as required
menu_order = 200 # will put in 3rd place (000 being 1st, 100 2nd)
add_to_settings_menu = False # or True to add your model to the Settings sub-menu
exclude_from_explorer = False # or True to exclude pages of this type from Wagtail's explorer view
modeladmin_register(AbcWagtailAdmin)但它没有显示到wagtail管理菜单。我们将非常感谢您的帮助。
发布于 2017-07-25 16:49:52
你是否在已安装的应用程序中添加了'wagtail.contrib.modeladmin‘?
发布于 2017-07-25 16:59:45
包含AbcWagtailAdmin定义和modeladmin_register调用的文件应该称为wagtail_hooks.py,而不是wagtail_hook.py
参考文献:
https://stackoverflow.com/questions/45298087
复制相似问题