Skip to content

Commit

Permalink
patch for bad formset configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-filicetti committed Sep 7, 2020
1 parent 3308d17 commit 935e343
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions uni_ticket/templatetags/uni_ticket_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ def get_label_from_form(form, field_name):
if field:
# toDo: better reference to django_form_builder for regex and methods
_regexp = '(?P<colname>[a-zA-Z0-9_ ]*)'
content = re.search(_regexp, field.choices[0])
content = re.search(_regexp, field.choices[0]) if field.choices else False
###
if content.groupdict()['colname'] == formset_field_name_parts[1]:
if content and content.groupdict()['colname'] == formset_field_name_parts[1]:
# get formset field pre_text
return (False, getattr(field, 'pre_text', False))
return False
Expand Down

0 comments on commit 935e343

Please sign in to comment.