Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fields Side-by-Side Within Two Columns #179

Open
SidSidSid16 opened this issue Aug 23, 2021 · 0 comments
Open

Fields Side-by-Side Within Two Columns #179

SidSidSid16 opened this issue Aug 23, 2021 · 0 comments

Comments

@SidSidSid16
Copy link

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)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant