More logic for index; pre_login_test view; follower_graph stub view
This commit is contained in:
parent
97a2191b1a
commit
63de6467f6
1 changed files with 23 additions and 1 deletions
24
views.py
24
views.py
|
@ -1,5 +1,27 @@
|
|||
from django.shortcuts import render_to_response
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.shortcuts import redirect, render_to_response
|
||||
|
||||
|
||||
def index(request):
|
||||
'''Index page. Everyone starts here. If the user is logged in (that is, they
|
||||
have a session id) redirect them to the follower graph view. Otherwise,
|
||||
render the index page.'''
|
||||
if request.method == 'POST':
|
||||
request.session.set_test_cookie()
|
||||
return redirect('login')
|
||||
if 'sessionid' in request.session:
|
||||
return follower_graph(request)
|
||||
return render_to_response('login.html')
|
||||
|
||||
|
||||
def pre_login_test(request):
|
||||
if request.session.test_cookie_worked():
|
||||
request.session.delete_test_cookie()
|
||||
return redirect('/login/github/')
|
||||
else:
|
||||
return render_to_response('login.html')
|
||||
|
||||
|
||||
@login_required
|
||||
def follower_graph(request):
|
||||
return 'Hello!'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue