Voucher import: Fix validation quirks

This commit is contained in:
Raphael Michel
2024-05-03 16:06:40 +02:00
parent 806124304a
commit 9da65f60d7
2 changed files with 6 additions and 5 deletions

View File

@@ -370,10 +370,11 @@ class Voucher(LoggedModel):
'redeemed': redeemed
}
)
if data.get('max_usages', 1) < data.get('min_usages', 1):
raise ValidationError(
_('The maximum number of usages may not be lower than the minimum number of usages.'),
)
if data.get('min_usages') is not None:
if data.get('max_usages', 1) < data.get('min_usages', 1):
raise ValidationError(
_('The maximum number of usages may not be lower than the minimum number of usages.'),
)
@staticmethod
def clean_subevent(data, event):