summaryrefslogtreecommitdiff
path: root/testapp/exam/views.py
diff options
context:
space:
mode:
authorhardythe12012-02-20 20:29:06 +0530
committerhardythe12012-02-20 20:29:06 +0530
commitddb7f4e07771f4e4ca514c253d671698e1b74020 (patch)
tree1b476a130efb9eca565ea3fa7d588bf454b98796 /testapp/exam/views.py
parentc61396a219efb3b078094d028e41fe51bc857fe3 (diff)
downloadonline_test-ddb7f4e07771f4e4ca514c253d671698e1b74020.tar.gz
online_test-ddb7f4e07771f4e4ca514c253d671698e1b74020.tar.bz2
online_test-ddb7f4e07771f4e4ca514c253d671698e1b74020.zip
changes to manage quiz
Diffstat (limited to 'testapp/exam/views.py')
-rw-r--r--testapp/exam/views.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/testapp/exam/views.py b/testapp/exam/views.py
index b8233b2..6dd5fb4 100644
--- a/testapp/exam/views.py
+++ b/testapp/exam/views.py
@@ -115,7 +115,7 @@ def add_quiz(request):
if form.is_valid():
data = form.cleaned_data
form.save()
- return my_redirect("/exam/manage/addquiz")
+ return my_redirect("/exam/manage/showquiz")
else:
return my_render_to_response('exam/add_quiz.html',
@@ -355,6 +355,35 @@ def show_all_users(request):
print context
return my_render_to_response('exam/showusers.html',context,context_instance=RequestContext(request))
+def show_all_quiz(request):
+ if request.method == 'POST':
+ data = request.POST.getlist('quiz')
+ if data == None:
+ quizzes = Quiz.objects.all()
+ context = {'papers': [],
+ 'quiz': None,
+ 'quizzes':quizzes}
+ return my_render_to_response('exam/show_quiz.html', context,
+ context_instance=RequestContext(request))
+ for i in data:
+ quiz = Quiz.objects.get(id=i).delete()
+ quizzes = Quiz.objects.all()
+ context = {'papers': [],
+ 'quiz': None,
+ 'quizzes':quizzes}
+ return my_render_to_response('exam/show_quiz.html', context,
+ context_instance=RequestContext(request))
+
+ else:
+ """Show the list of available quiz"""
+ quizzes = Quiz.objects.all()
+ context = {'papers': [],
+ 'quiz': None,
+ 'quizzes':quizzes}
+ return my_render_to_response('exam/show_quiz.html', context,
+ context_instance=RequestContext(request))
+
+
def show_all_questions(request):
if request.method == 'POST':
data = request.POST.getlist('question')