From 9c61c84194e6b52913dfc284765a7b7bd77201ad Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Tue, 5 Jul 2016 17:50:31 +0530 Subject: will not create trial paper object if the quiz has expired or is inactive --- yaksh/views.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'yaksh/views.py') 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)) -- cgit