From 8aecf4f98f5d55c51124db5fec3cabbfbb7d9522 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 26 Apr 2024 11:20:36 +0200 Subject: [PATCH] Voucher import: Validate code not empty --- src/pretix/base/modelimport_vouchers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pretix/base/modelimport_vouchers.py b/src/pretix/base/modelimport_vouchers.py index 13a123fe0..81ba9f18d 100644 --- a/src/pretix/base/modelimport_vouchers.py +++ b/src/pretix/base/modelimport_vouchers.py @@ -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()):