【发布时间】:2021-09-22 20:00:47
【问题描述】:
有没有办法在创建新页面时使用具有默认块的 StreamField 创建页面模型?
例如我有这个自定义页面:
class CustomPage(Page):
body = StreamField([("text", TextBlock())])
当我打开“添加新页面”视图时,我总是希望在正文中有一个带有默认文本的文本块。
以及如何使用像ItemList 这样更复杂的块来做到这一点?
class Item(StructBlock):
text = CharBlock()
image = ImageChooserBlock()
class ItemList(StructBlock):
items = StreamBlock([("item", Item()),])
【问题讨论】:
标签: wagtail wagtail-streamfield wagtail-admin