Added Voucher expiration check in form using model property.
This commit is contained in:
parent
a3b123a207
commit
2bff4db1d7
@ -26,6 +26,10 @@ class ExplorerCreationForm(UserCreationForm):
|
|||||||
self.add_error('voucher', 'Invalid voucher')
|
self.add_error('voucher', 'Invalid voucher')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
if not submitted_voucher.valid:
|
||||||
|
self.add_error('voucher', 'Expired voucher')
|
||||||
|
return False
|
||||||
|
|
||||||
fetched_voucher.delete()
|
fetched_voucher.delete()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user