Voucher creation: Search for duplicates based on upper version

This commit is contained in:
Raphael Michel
2023-04-17 09:14:34 +02:00
parent 57252dca2e
commit e65ef392a3

View File

@@ -454,7 +454,7 @@ class Voucher(LoggedModel):
@staticmethod
def clean_voucher_code(data, event, pk):
if 'code' in data and Voucher.objects.filter(Q(code__iexact=data['code']) & Q(event=event) & ~Q(pk=pk)).exists():
if 'code' in data and Voucher.objects.filter(Q(code__iexact=data['code'].upper()) & Q(event=event) & ~Q(pk=pk)).exists():
raise ValidationError(_('A voucher with this code already exists.'))
@staticmethod