Merge branch 'voucher' of mowoe.com:reverend/lostplaces-backend into voucher
This commit is contained in:
commit
dc318d4f98
@ -11,6 +11,18 @@ class ExplorerCreationForm(UserCreationForm):
|
||||
class Meta:
|
||||
model = Explorer
|
||||
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:
|
||||
|
@ -2,7 +2,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
''' Django views. '''
|
||||
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic.edit import CreateView
|
||||
|
Loading…
Reference in New Issue
Block a user