From b09cfa8018f429db296da5a05d638651c3f11207 Mon Sep 17 00:00:00 2001 From: parth Date: Fri, 9 Mar 2012 10:27:37 +0530 Subject: working logout --- allotter/urls.py | 4 +++- allotter/views.py | 10 +++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/allotter/urls.py b/allotter/urls.py index b90e200..593ad57 100644 --- a/allotter/urls.py +++ b/allotter/urls.py @@ -1,10 +1,12 @@ from django.conf.urls.defaults import patterns, url urlpatterns = patterns('allotter.views', - url(r'^$', 'hello'), + url(r'^$', 'apply'), url(r'^login/$', 'user_login'), + url(r'^logout/$', 'user_logout'), url(r'^register/$', 'user_register'), url(r'^apply/$', 'apply'), url(r'^quit/$', 'quit'), url(r'^save/$', 'save'), + ) diff --git a/allotter/views.py b/allotter/views.py index 52d1d0e..4c1bd8e 100644 --- a/allotter/views.py +++ b/allotter/views.py @@ -63,13 +63,6 @@ def user_login(request): context_instance=RequestContext(request)) @login_required -def hello(request): - user = request.user - context = {'user': user} - ci = RequestContext(request) - return render_to_response('allotter/hello.html', context, - context_instance=ci) -@login_required def apply(request): user = request.user if not(user.is_authenticated()): @@ -83,3 +76,6 @@ def apply(request): return render_to_response('allotter/apply.html', context, context_instance=ci) +def user_logout(request): + logout(request) + return redirect ('/allotter/') -- cgit From 83a237759bf184c1907efe56b8bf27a630112923 Mon Sep 17 00:00:00 2001 From: parth Date: Fri, 9 Mar 2012 10:29:35 +0530 Subject: logout link --- template/allotter/apply.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/template/allotter/apply.html b/template/allotter/apply.html index f397cb9..50cdbfc 100644 --- a/template/allotter/apply.html +++ b/template/allotter/apply.html @@ -3,6 +3,12 @@ {% block title %}Application form {% endblock %} {% block content %} + +

Hello, there

+ +

Welcome {{user.first_name.title}} {{user.last_name.title}}, +to JAM 2012 allotment!

+ Choose the options as per your preference

{{user.first_name}} {{user.last_name}}

@@ -24,4 +30,5 @@ Choose the options as per your preference +Logout {% endblock content %} -- cgit