Added Voucher expiration check in form using model property.

This commit is contained in:
Marcus Scholz 2020-09-18 21:02:45 +02:00
parent a3b123a207
commit 2bff4db1d7

View File

@ -26,6 +26,10 @@ class ExplorerCreationForm(UserCreationForm):
self.add_error('voucher', 'Invalid voucher')
return False
if not submitted_voucher.valid:
self.add_error('voucher', 'Expired voucher')
return False
fetched_voucher.delete()
return True