wagtail rawhtmlblock 错误?
wagtail rawhtmlblock error?
我正在尝试测试 wagtail
RawHTMLBlock
,这是我的代码 (models.py):
from __future__ import absolute_import, unicode_literals
from wagtail.wagtailcore import blocks
from wagtail.wagtailcore.fields import StreamField
from wagtail.wagtailcore.models import Page
from wagtail.wagtailadmin.edit_handlers import FieldPanel
class HomePage(Page):
body = StreamField([
('raw_html', blocks.RawHTMLBlock()),
])
content_panels = Page.content_panels + [
FieldPanel('body')
]
现在我想添加一个主页并在我网站的管理部分的正文中添加一些 html,但我做不到,因为我在 chrome's
控制台:
stream.js:87 Uncaught TypeError: Cannot read property 'initializer' of undefined
at Object.onInitializeMember (stream.js:87)
at postInsertMember (sequence.js:95)
at Object.self.insertMemberAtStart (sequence.js:196)
at Object.onChooseBlock (stream.js:140)
at HTMLButtonElement.<anonymous> (stream.js:60)
at HTMLButtonElement.dispatch (jquery-2.2.1.min.js:3)
at HTMLButtonElement.r.handle (jquery-2.2.1.min.js:3)
wagtail 版本是 1.13.1
,有什么想法吗?
StreamField
需要使用StreamFieldPanel
,而不是FieldPanel
。
from wagtail.wagtailadmin.edit_handlers import StreamFieldPanel
# ...
content_panels = Page.content_panels + [
StreamFieldPanel('body')
]
我正在尝试测试 wagtail
RawHTMLBlock
,这是我的代码 (models.py):
from __future__ import absolute_import, unicode_literals
from wagtail.wagtailcore import blocks
from wagtail.wagtailcore.fields import StreamField
from wagtail.wagtailcore.models import Page
from wagtail.wagtailadmin.edit_handlers import FieldPanel
class HomePage(Page):
body = StreamField([
('raw_html', blocks.RawHTMLBlock()),
])
content_panels = Page.content_panels + [
FieldPanel('body')
]
现在我想添加一个主页并在我网站的管理部分的正文中添加一些 html,但我做不到,因为我在 chrome's
控制台:
stream.js:87 Uncaught TypeError: Cannot read property 'initializer' of undefined
at Object.onInitializeMember (stream.js:87)
at postInsertMember (sequence.js:95)
at Object.self.insertMemberAtStart (sequence.js:196)
at Object.onChooseBlock (stream.js:140)
at HTMLButtonElement.<anonymous> (stream.js:60)
at HTMLButtonElement.dispatch (jquery-2.2.1.min.js:3)
at HTMLButtonElement.r.handle (jquery-2.2.1.min.js:3)
wagtail 版本是 1.13.1
,有什么想法吗?
StreamField
需要使用StreamFieldPanel
,而不是FieldPanel
。
from wagtail.wagtailadmin.edit_handlers import StreamFieldPanel
# ...
content_panels = Page.content_panels + [
StreamFieldPanel('body')
]