Added signup formcheck signup.
This commit is contained in:
parent
ca1bc12e88
commit
3ab5bf6826
@ -13,6 +13,17 @@ class ExplorerCreationForm(UserCreationForm):
|
||||
fields = ('username', 'email')
|
||||
voucher = forms.CharField(max_length=10)
|
||||
|
||||
def is_valid(self):
|
||||
super().is_valid()
|
||||
sumitted_voucher = self.cleaned_data.get('voucher')
|
||||
try:
|
||||
fetched_voucher = Voucher.objects.get(code=sumitted_voucher)
|
||||
except Voucher.DoesNotExist:
|
||||
return False
|
||||
|
||||
fetched_voucher.delete()
|
||||
return True
|
||||
|
||||
class ExplorerChangeForm(UserChangeForm):
|
||||
class Meta:
|
||||
model = Explorer
|
||||
|
Loading…
Reference in New Issue
Block a user