Titivillus/signup/views.py

24 lines
532 B
Python
Raw Normal View History

2018-08-10 19:14:33 -04:00
#!/usr/bin/env python3
"""
/signup app views.
"""
# TODO: make unique username validation be case insensitive
from django.shortcuts import redirect, render
from .forms import SignupForm
2018-08-10 19:14:33 -04:00
def index(request):
"""
The signup page.
"""
if request.user.is_authenticated:
return redirect('homepage:index')
if request.method == 'POST':
form = SignupForm(request.POST)
if form.is_valid():
form.save()
return redirect('login:index')
else:
form = SignupForm()
return render(request, 'signup/index.html', {'form': form})