Skip to content

Commit

Permalink
Merge pull request #3 from typecode/field-fixes
Browse files Browse the repository at this point in the history
Fixes for dropdown and checkboxes fields
  • Loading branch information
fredevery authored Oct 18, 2022
2 parents b33e80d + cc10071 commit c94cef2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions wagtail_advanced_form_builder/forms/advanced_form_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def create_html_field(self, field, options):

def create_dropdown_field(self, field, options):
options['choices'] = list(map(
lambda x: (x.strip(), x.strip()),
lambda x: (x.get('value', '').strip(), x.get('value', '').strip()),
field.choices
))
if field.empty_label:
Expand All @@ -46,11 +46,12 @@ def create_dropdown_field(self, field, options):

def create_checkboxes_field(self, field, options):
options['choices'] = list(map(
lambda x: (x.strip(), x.strip()),
lambda x: (x.get('value', '').strip(), x.get('value', '').strip()),
field.choices
))

options['initial'] = list(map(
lambda x: (x.strip(), x.strip()),
lambda x: x.get('value', '').strip(),
field.default_value
))

Expand Down

0 comments on commit c94cef2

Please sign in to comment.