mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Voucher import: Validate code not empty
This commit is contained in:
@@ -44,6 +44,8 @@ class CodeColumn(ImportColumn):
|
||||
super().__init__(*args)
|
||||
|
||||
def clean(self, value, previous_values):
|
||||
if not value:
|
||||
raise ValidationError(_('A voucher cannot be created without a code.'))
|
||||
if value:
|
||||
MinLengthValidator(5)(value)
|
||||
if value and (value in self._cached or Voucher.objects.filter(event=self.event, code=value).exists()):
|
||||
|
||||
Reference in New Issue
Block a user