wagtail rawhtmlblock 错误?

Ale*_*xey 3 python wagtail

我正在尝试测试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')
    ]
Run Code Online (Sandbox Code Playgroud)

现在我正在尝试添加一个主页并在我网站的管理部分向正文添加一些 html,但我无法这样做,因为我在chrome's控制台中收到此 js 错误:

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)
Run Code Online (Sandbox Code Playgroud)

wagtail 版本是1.13.1,有什么想法吗?

gas*_*man 6

StreamFields 需要使用StreamFieldPanel,而不是FieldPanel

from wagtail.wagtailadmin.edit_handlers import StreamFieldPanel

# ...
    content_panels = Page.content_panels + [
        StreamFieldPanel('body')
    ]
Run Code Online (Sandbox Code Playgroud)