Browse Source

retira código desnecessário de verificação de fields de formulários

pull/2495/head
Leandro Roberto 6 years ago
parent
commit
e48398ce9c
  1. 21
      sapl/crispy_layout_mixin.py

21
sapl/crispy_layout_mixin.py

@ -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

Loading…
Cancel
Save