consolidated objects into one benchcoach app
created benchcoachproject app to contain all the settings and stuff some other changes that got grouped with this commit is the adding the ApiObject to the TeamSnap object model
This commit is contained in:
31
benchcoachproject/views.py
Normal file
31
benchcoachproject/views.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import render,redirect, reverse, HttpResponseRedirect
|
||||
from django.contrib.auth import login,authenticate
|
||||
|
||||
def welcome(request):
|
||||
pages = ['event list', 'team list', 'venue list', 'player list', 'teamsnap list events', 'teamsnap home', 'login']
|
||||
return render(request,'home.html',{'pages':pages})
|
||||
|
||||
|
||||
def user_login(request):
|
||||
if request.method == 'POST':
|
||||
username = request.POST.get('username')
|
||||
password = request.POST.get('password')
|
||||
|
||||
try:
|
||||
user = authenticate(request, username=username, password=password)
|
||||
if user is not None:
|
||||
print('Login')
|
||||
login(request,user)
|
||||
return redirect(reverse('home'))
|
||||
else:
|
||||
print("Someone tried to login and failed.")
|
||||
print("They used username: {} and password: {}".format(username, password))
|
||||
|
||||
return redirect('/')
|
||||
except Exception as identifier:
|
||||
|
||||
return redirect('/')
|
||||
|
||||
else:
|
||||
return render(request, 'login.html')
|
||||
Reference in New Issue
Block a user