summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authoradityacp2016-09-02 12:59:20 +0530
committeradityacp2016-09-02 12:59:20 +0530
commit3c1bbe9d8c53c419d2fa2a254228484ea74aab96 (patch)
tree505e646133b52fe56fe1006ad48007cf01c61125 /yaksh/views.py
parent83fe192987c239287bf816a31f4da31910eb7087 (diff)
parent01e08dd15b59ce353043d541c9be81592cda3fe0 (diff)
downloadonline_test-3c1bbe9d8c53c419d2fa2a254228484ea74aab96.tar.gz
online_test-3c1bbe9d8c53c419d2fa2a254228484ea74aab96.tar.bz2
online_test-3c1bbe9d8c53c419d2fa2a254228484ea74aab96.zip
refactor in test_models and updated with latest changes
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index bfa36fd..a9e17ab 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -1273,3 +1273,15 @@ def test_quiz(request, mode, quiz_id):
trial_questionpaper = test_mode(current_user, godmode, None, quiz_id)
return my_redirect("/exam/start/{0}".format(trial_questionpaper.id))
+
+
+@login_required
+def view_answerpaper(request, questionpaper_id):
+ user = request.user
+ quiz = get_object_or_404(QuestionPaper, pk=questionpaper_id).quiz
+ if quiz.view_answerpaper and user in quiz.course.students.all():
+ data = AnswerPaper.objects.get_user_data(user, questionpaper_id)
+ context = {'data': data, 'quiz': quiz}
+ return my_render_to_response('yaksh/view_answerpaper.html', context)
+ else:
+ return my_redirect('/exam/quizzes/')