|
@ -220,31 +220,10 @@ class CrispyLayoutFormMixin: |
|
|
form.helper = SaplFormHelper() |
|
|
form.helper = SaplFormHelper() |
|
|
layout = self.get_layout() |
|
|
layout = self.get_layout() |
|
|
|
|
|
|
|
|
"""if hasattr(form, '_meta') and \ |
|
|
|
|
|
hasattr(form._meta, 'fields') and \ |
|
|
|
|
|
form._meta.fields is not None: |
|
|
|
|
|
self.validate_layout(form, layout)""" |
|
|
|
|
|
|
|
|
|
|
|
form.helper.layout = SaplFormLayout(*layout) |
|
|
form.helper.layout = SaplFormLayout(*layout) |
|
|
|
|
|
|
|
|
return form |
|
|
return form |
|
|
|
|
|
|
|
|
"""def validate_layout(self, form, layout): |
|
|
|
|
|
fields = set() |
|
|
|
|
|
for fieldset in layout: |
|
|
|
|
|
for el in fieldset: |
|
|
|
|
|
if isinstance(el, str): |
|
|
|
|
|
continue |
|
|
|
|
|
for field, size in el: |
|
|
|
|
|
fields.add(field) |
|
|
|
|
|
|
|
|
|
|
|
intersection = set(form._meta.fields) - fields |
|
|
|
|
|
|
|
|
|
|
|
if intersection: |
|
|
|
|
|
raise Exception(_('Os campos {} não aparecem na definição de layout' |
|
|
|
|
|
' da interface do usuário').format(intersection)) |
|
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
@property |
|
|
def list_field_names(self): |
|
|
def list_field_names(self): |
|
|
'''The list of field names to display on table |
|
|
'''The list of field names to display on table |
|
|