added "return to admin page" link in open_quiz page
authornishanth
Wed, 21 Apr 2010 19:33:18 +0530
changeset 34 8d0d82c981b3
parent 33 d28d0957a5ab
child 35 f64c68963d54
added "return to admin page" link in open_quiz page
event/views.py
templates/open_quiz.html
--- a/event/views.py	Wed Apr 21 19:17:47 2010 +0530
+++ b/event/views.py	Wed Apr 21 19:33:18 2010 +0530
@@ -5,6 +5,11 @@
 from offline.event.forms import EventCreateForm
 from offline.settings import ADMIN_KEY
 
+num2name = {"11" : "Day 1 Quiz 1",
+            "12" : "Day 1 Quiz 2",
+            "21" : "Day 2 Quiz 1",
+           }
+
 def event_home(request):
     """ The page for people to view.
     """
@@ -82,7 +87,7 @@
             quiz_num = request.POST['quiz_num']
             event.quiz_status = quiz_num
             event.save()
-            return render_to_response("open_quiz.html",{'success':True})
+            return render_to_response("open_quiz.html",{"admin_key":ADMIN_KEY, "quiz_name":num2name[quiz_num], 'success':True})
         except MultiValueDictKeyError:
             raise Http404
     else:
--- a/templates/open_quiz.html	Wed Apr 21 19:17:47 2010 +0530
+++ b/templates/open_quiz.html	Wed Apr 21 19:33:18 2010 +0530
@@ -1,7 +1,8 @@
 {% extends 'base.html' %}
 {% block content %}
 	{% if success %}
-		The quiz has been successfully opened.
+	The quiz {{quiz_name}} has been successfully opened.<br />
+	<a href="/event/admin/{{admin_key}}">Return to admin page</a>
 	{% else %}
 	Select the quiz to open.
 	<form action="" method="post">