summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormahesh2016-05-03 15:10:30 +0530
committermahesh2016-05-04 11:52:01 +0530
commit7746a43a84b58b3234553f458e146d7294e8e4f8 (patch)
tree3a53428393dcb098cf46bc1d8580124ab4261735
parent4341bf83f9eef904a9dd5f515dd0159f9c05de7d (diff)
downloadonline_test-7746a43a84b58b3234553f458e146d7294e8e4f8.tar.gz
online_test-7746a43a84b58b3234553f458e146d7294e8e4f8.tar.bz2
online_test-7746a43a84b58b3234553f458e146d7294e8e4f8.zip
modified try statement in grade_user
-rw-r--r--yaksh/views.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 587ca57..f6045d8 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -902,21 +902,23 @@ def grade_user(request, quiz_id=None, user_id=None, attempt_number=None):
(questionpaper_id)
context = {"users": user_details, "quiz_id": quiz_id}
if user_id is not None:
+
+ attempts = AnswerPaper.objects.get_user_all_attempts\
+ (questionpaper_id, user_id)
try:
- attempts = AnswerPaper.objects.get_user_all_attempts\
- (questionpaper_id, user_id)
if attempt_number is None:
attempt_number = attempts[0].attempt_number
except IndexError:
raise Http404('No attempts for paper')
- user = User.objects.get(id=user_id)
- data = AnswerPaper.objects.get_user_data(user,questionpaper_id,
+
+ user = User.objects.get(id=user_id)
+ data = AnswerPaper.objects.get_user_data(user, questionpaper_id,
attempt_number
)
- context = {'data': data,"quiz_id": quiz_id, "users": user_details,
- "attempts": attempts,"user_id":user_id
- }
+ context = {'data': data, "quiz_id": quiz_id, "users": user_details,
+ "attempts": attempts, "user_id": user_id
+ }
if request.method == "POST":
papers = data['papers']
for paper in papers:
@@ -930,8 +932,10 @@ def grade_user(request, quiz_id=None, user_id=None, attempt_number=None):
'comments_%d' % paper.question_paper.id, 'No comments')
paper.save()
-
- return my_render_to_response('yaksh/grade_user.html', context, context_instance=ci)
+
+ return my_render_to_response('yaksh/grade_user.html',
+ context, context_instance=ci
+ )
@csrf_exempt