diff options
author | Prabhu Ramachandran | 2016-08-31 17:36:03 +0530 |
---|---|---|
committer | GitHub | 2016-08-31 17:36:03 +0530 |
commit | 27e7a443ef132e04cc5aeece7a5bf34d0687f482 (patch) | |
tree | 5107b580ad56199f021bdaeac04af71a7921f490 /yaksh/views.py | |
parent | aefc8eed3b0c18520059b4005978f1db9cf5591b (diff) | |
parent | 18cbf091f991cd205a07c87db0ddde980bef34e2 (diff) | |
download | online_test-27e7a443ef132e04cc5aeece7a5bf34d0687f482.tar.gz online_test-27e7a443ef132e04cc5aeece7a5bf34d0687f482.tar.bz2 online_test-27e7a443ef132e04cc5aeece7a5bf34d0687f482.zip |
Merge pull request #129 from prathamesh920/view_answerpaper
View answerpaper
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 923b3c2..1abf248 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -1261,3 +1261,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/') |