summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authormaheshgudi2016-07-05 17:50:31 +0530
committermaheshgudi2016-07-05 17:50:31 +0530
commit9c61c84194e6b52913dfc284765a7b7bd77201ad (patch)
tree384f452958efad8cbc1cdc1a518f6fc2c09087e9 /yaksh/views.py
parent1276c2840c3c7f7521c98574dea302160611f79d (diff)
downloadonline_test-9c61c84194e6b52913dfc284765a7b7bd77201ad.tar.gz
online_test-9c61c84194e6b52913dfc284765a7b7bd77201ad.tar.bz2
online_test-9c61c84194e6b52913dfc284765a7b7bd77201ad.zip
will not create trial paper object if the quiz has expired or is inactive
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 3db51a9..ae32bbf 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -1240,5 +1240,9 @@ def test_quiz(request, mode, quiz_id):
"""creates a trial quiz for the moderators"""
godmode = True if mode == "godmode" else False
current_user = request.user
+ quiz = Quiz.objects.get(id=quiz_id)
+ if (quiz.is_expired() or not quiz.active) and not godmode:
+ return my_redirect('/exam/manage')
+
trial_questionpaper = test_mode(current_user, godmode, None, quiz_id)
return my_redirect("/exam/start/{0}".format(trial_questionpaper.id))