Check if user is authenticated and show follower_graph

This commit is contained in:
Eryn Wells 2012-08-18 09:27:56 -07:00
parent d2fc4ca84b
commit fdb900a8a3

View file

@ -1,4 +1,5 @@
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import redirect, render_to_response from django.shortcuts import redirect, render_to_response
from django.template import RequestContext from django.template import RequestContext
@ -7,7 +8,7 @@ def index(request):
'''Index page. Everyone starts here. If the user is logged in (that is, they '''Index page. Everyone starts here. If the user is logged in (that is, they
have a session id) return the follower_graph view. Otherwise, render the have a session id) return the follower_graph view. Otherwise, render the
index page.''' index page.'''
if request.session.get('sessionid', False): if request.user.is_authenticated():
return follower_graph(request) return follower_graph(request)
# Set a test cookie. When the user clicks the 'Login' button, test and make # Set a test cookie. When the user clicks the 'Login' button, test and make
# sure this cookie was set properly. # sure this cookie was set properly.
@ -34,4 +35,4 @@ def login(request):
@login_required @login_required
def follower_graph(request): def follower_graph(request):
return 'Hello!' return render_to_response('index.html', RequestContext(request))