Created
October 20, 2018 02:41
-
-
Save Elise-Lennion/0d83a7e34d2d7173013546114f1689bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.forms import AuthenticationForm | |
from django.shortcuts import render | |
from research.forms import UserCreateForm # Custom register form | |
def front_page_view(request): | |
if request.method == 'POST': | |
if 'login_form' in request.POST: | |
login_form = AuthenticationForm(request=request, data=request.POST) | |
register_form = UserCreateForm() | |
# Do things for the login form | |
elif 'register_form' in request.POST: | |
login_form = AuthenticationForm() | |
register_form = UserCreateForm(request.POST) | |
# Do things for the register form | |
else: | |
login_form = AuthenticationForm() | |
register_form = UserCreateForm() | |
return render(request, 'front_page.html', {'register_form': register_form, 'login_form': login_form}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment