Skip to content

Commit

Permalink
Don't crash when adding invalid both dynafield and scannerfield
Browse files Browse the repository at this point in the history
When adding both an invalid dynafield and an invalid scannerfield in the
same form, both fields come back as None, and then crashes. If added one
by one the correct error was shown, but of course this should work in
both cases.
  • Loading branch information
mhagander committed Nov 22, 2023
1 parent 11a6e29 commit f4d94bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions postgresqleu/confreg/backendforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ def clean(self):
if cleaned_data.get('checkinactive') and not cleaned_data.get('tickets'):
self.add_error('checkinactive', 'Check-in cannot be activated if tickets are not used!')

dynafields = set([x for x in cleaned_data.get('dynafields').split(',') if x])
scannerfields = set([x for x in cleaned_data.get('scannerfields').split(',') if x])
dynafields = set([x for x in cleaned_data.get('dynafields', '').split(',') if x])
scannerfields = set([x for x in cleaned_data.get('scannerfields', '').split(',') if x])
if scannerfields - dynafields:
self.add_error('scannerfields', 'Only fields from the list of dynamic properties can be used. Incorrect fields: {}'.format(", ".join(scannerfields - dynafields)))

Expand Down

0 comments on commit f4d94bc

Please sign in to comment.