如何在RawHTMLBlock字段中插入图像,即blocks.RawHTMLBlock(icon ='code',label ='HTML')

时间:2018-07-10 13:10:01

标签: wagtail

我正在尝试在blocks.RawHTMLBlock()中插入图像,但是没有发生。拜托,有人知道该怎么做吗? 我的models.py

wagtail.core.blocks.RawHTMLBlock

 body = StreamField([
        ('heading', blocks.CharBlock(classname="full title")),
        ('paragraph', blocks.RichTextBlock()),
        ('image', ImageChooserBlock(icon='image')),
        ('rich_text', blocks.RichTextBlock(icon='doc-full', label='Rich Text')),
        ('html', blocks.RawHTMLBlock(icon='code', label='HTML', image='image')),
    ])

    content_panels = Page.content_panels + [
        StreamFieldPanel('body'),
    ]

1 个答案:

答案 0 :(得分:0)

RawHTMLBlock用于输入HTML代码,将其直接输出到页面上,而无需Wagtail进行进一步处理。因此,要输出图像,请使用标准的HTML标签:<img src="...">