Error message in the form when the voucher is invalid

This commit is contained in:
reverend 2020-08-05 10:15:51 +02:00
parent 28d09c968a
commit 8f9e1b5877

View File

@ -19,6 +19,7 @@ class ExplorerCreationForm(UserCreationForm):
try: try:
fetched_voucher = Voucher.objects.get(code=sumitted_voucher) fetched_voucher = Voucher.objects.get(code=sumitted_voucher)
except Voucher.DoesNotExist: except Voucher.DoesNotExist:
self.add_error('voucher', 'Invalid voucher')
return False return False
fetched_voucher.delete() fetched_voucher.delete()