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
|
|
|
|
from django.urls import reverse
|
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'
|
|
|
|
# TODO reverse
|
|
|
|
success_url = '/thanks'
|
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-11-30 07:48:02 +00:00
|
|
|
#t = Townie(
|
|
|
|
# username=username,
|
|
|
|
# displayname=displayname,
|
|
|
|
# pubkey=pubkey,
|
|
|
|
# email=email,
|
|
|
|
#)
|
2016-11-21 07:56:55 +00:00
|
|
|
|
2016-11-30 07:48:02 +00:00
|
|
|
#t.set_unusable_password()
|
|
|
|
#t.save()
|
2016-11-21 07:56:55 +00:00
|
|
|
|
2016-11-30 07:48:02 +00:00
|
|
|
return super().form_valid(form)
|
2016-11-21 07:56:55 +00:00
|
|
|
|
|
|
|
|
2016-11-30 07:48:02 +00:00
|
|
|
# TODO add template for this once i've fixed template directories
|
|
|
|
class ThanksView(TemplateView):
|
|
|
|
template_name = 'users/thanks.html'
|