I wanted my users to be able to define a columnar layouts in the wagtail freeform editor.
To do that I have created a stream block as follows:
class ColumnSplitBlock(blocks.StreamBlock):
class Meta:
template = "common/column_split_block.html"
icon = "grip"
label = _("Columns")
min_num = 1
max_num = 2
and then I've plugged it into my Page's Streamfield:
class NewsDetailPage(Page):
template = "news/news_detail_page.html"
parent_page_types = ['news.NewsListPage']
content = StreamField([
("rich_text", blocks.RichTextBlock()),
("image", blocks.ImageBlock()),
("column_split", blocks.ColumnSplitBlock(
[
("rich_text", blocks.RichTextBlock()),
("image", ImageChooserBlock()),
]
)),
], verbose_name=_("Content"))
content_panels = Page.content_panels + [
StreamFieldPanel("content"),
]
However, I'd like to customize the display of ColumnSplitBlock inside the StreamBlock.
In particular I wanted to use FieldRowPanel to create as mentioned the columnar layout in the admin editor. Is that even possible?