forked from CGM_Public/pretix_original
Check-in list editor: Allow to delete last rule
This commit is contained in:
@@ -225,6 +225,11 @@ class CheckinList(LoggedModel):
|
||||
for v in values:
|
||||
cls.validate_rules(v, seen_nonbool=seen_nonbool or operator not in ('or', 'and'), depth=depth + 1)
|
||||
|
||||
if operator in ('or', 'and') and depth == 0 and not values:
|
||||
return {}
|
||||
|
||||
return rules
|
||||
|
||||
|
||||
class Checkin(models.Model):
|
||||
"""
|
||||
|
||||
@@ -128,7 +128,7 @@ class CheckinListForm(forms.ModelForm):
|
||||
|
||||
def clean(self):
|
||||
d = super().clean()
|
||||
CheckinList.validate_rules(d.get('rules'))
|
||||
d['rules'] = CheckinList.validate_rules(d.get('rules'))
|
||||
return d
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user