Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Fixes fieldsets only showing up once on static forms
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Krienbühl committed Nov 6, 2015
1 parent e990023 commit 545c3a4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions onegov/form/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@ class MyForm(Form):
def __init__(self, *args, **kwargs):

# consume the fieldset attribute of all unbound fields, as WTForms
# doesn't know it
# doesn't know it -> move it to the field which is a *class* attribute
# (so this only happens once per class)
for field_id, field in self._unbound_fields:
if not hasattr(field, 'fieldset'):
field.fieldset = field.kwargs.pop('fieldset', None)

fields_by_fieldset = [
(field.kwargs.pop('fieldset', None), field_id)
(field.fieldset, field_id)
for field_id, field in self._unbound_fields
]

Expand Down

0 comments on commit 545c3a4

Please sign in to comment.