mirror of
https://github.com/pretix/pretix.git
synced 2026-10-01 19:14:43 +00:00
Update vouchers.py
This commit is contained in:
@@ -615,9 +615,15 @@ class VoucherBulkForm(VoucherForm):
|
||||
raise ValidationError(_('CSV input contains an unknown field with the header "{header}".').format(header=unknown_fields[0]))
|
||||
for i, row in enumerate(reader):
|
||||
try:
|
||||
EmailValidator()(row.get('email', '').strip())
|
||||
EmailValidator()((row['email'] or '').strip())
|
||||
except ValidationError as err:
|
||||
raise ValidationError(_('{value} in line {line} is not a valid email address.').format(line=i, value=row.get('email', '').strip())) from err
|
||||
raise ValidationError(
|
||||
_('Invalid email address ({email}) in row {number} ({value}).').format(
|
||||
number=i+1,
|
||||
value=', '.join(row.values()),
|
||||
email=row['email'] or _('empty column'),
|
||||
)
|
||||
) from err
|
||||
try:
|
||||
res.append(self.Recipient(
|
||||
name=row.get('name', ''),
|
||||
@@ -626,7 +632,12 @@ class VoucherBulkForm(VoucherForm):
|
||||
tag=row.get('tag', None)
|
||||
))
|
||||
except ValueError as err:
|
||||
raise ValidationError(_('Invalid value in row {number}.').format(number=i + 1)) from err
|
||||
raise ValidationError(
|
||||
_('Invalid value ({value}) in row {number}.').format(
|
||||
number=i + 1,
|
||||
value=escape(', '.join(row.values())),
|
||||
)
|
||||
) from err
|
||||
else:
|
||||
for e in r:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user