tildetown-admin/ttadmin/users/views.py

31 lines
794 B
Python
Raw Normal View History

2016-11-30 07:48:02 +00:00
import re
from django.core.exceptions import ValidationError
from django.forms import Form, CharField, EmailField, Textarea, ChoiceField, BooleanField
2016-11-20 05:34:38 +00:00
from django.http import HttpResponse
2016-11-30 07:48:02 +00:00
from django.shortcuts import redirect
2016-11-20 05:34:38 +00:00
from django.views.generic import TemplateView
2016-11-30 07:48:02 +00:00
from django.views.generic.edit import FormView
2016-11-20 05:34:38 +00:00
2016-11-30 07:48:02 +00:00
from .forms import TownieForm
from .models import Townie
2016-11-21 07:56:55 +00:00
2016-11-30 07:48:02 +00:00
class SignupView(FormView):
form_class = TownieForm
template_name = 'users/signup.html'
2016-11-21 07:56:55 +00:00
2016-11-30 07:48:02 +00:00
def form_valid(self, form):
2016-11-21 07:56:55 +00:00
2016-12-01 06:49:06 +00:00
del form.cleaned_data['captcha']
del form.cleaned_data['aup']
t = Townie(**form.cleaned_data)
t.set_unusable_password()
t.save()
return redirect('users:thanks')
2016-11-21 07:56:55 +00:00
2016-11-30 07:48:02 +00:00
class ThanksView(TemplateView):
template_name = 'users/thanks.html'