我在wagtail admin中添加了一个应用程序到我的边栏,但是如果我点击它就会出现此错误
我的model.py:
class TeamRoosterTwo(models.Model):
team_name = models.CharField(max_length=100, default="")
team_logo = models.ForeignKey(
'wagtailimages.Image',
null=True, blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
staff = StreamField([
('staff', CardsBlock(Staff(), icon="plus")),
], blank=True)
spieler = StreamField([
('spieler', CardsBlock(Spieler(), icon="user")),
], blank=True)
content_panels = [
FieldPanel('team_name', classname="col12"),
ImageChooserPanel('team_logo'),
StreamFieldPanel('staff'),
StreamFieldPanel('spieler'),
]
def __str__(self):
return self.team_name
我用以下代码创建了wagtail_hooks.py:
from wagtail.contrib.modeladmin.options import (
ModelAdmin, modeladmin_register)
from . models import TeamRoosterTwo
class TeamRoosterModelAdmin(ModelAdmin):
model = TeamRoosterTwo
menu_label = 'Treichle Cup'
menu_icon = 'group'
menu_order = 200
exclude_from_explorer = True
modeladmin_register(TeamRoosterModelAdmin)
答案 0 :(得分:1)
您可能错过了将wagtail.contrib.modeladmin
添加到INSTALLED_APPS:http://docs.wagtail.io/en/v1.13.1/reference/contrib/modeladmin/index.html#installation