wagtailstreamforms
wagtailstreamforms copied to clipboard
Fields Side-by-Side Within Two Columns
I would like to create a form with two fields side-by-side. I think of implementing this by registering a new field with two options, 'left' and 'right'. In each option, I will list all available fields which the user can then select.
from django import forms from wagtailstreamforms.fields import BaseField, register from wagtail.core import blocks
@register('two_columns')
class TwoColumns(BaseField):
widget = forms.Select
icon = 'list-ul'
label = 'Two Columns'
def get_form_block(self):
return blocks.StructBlock([
('left', ),
('right', )
], icon=self.icon, label=self.label)
Am I on the right track and how do I continue with this, (how do I list all fields)?