summaryrefslogtreecommitdiff
path: root/exam
diff options
context:
space:
mode:
authorPrabhu Ramachandran2011-11-14 00:00:33 +0530
committerPrabhu Ramachandran2011-11-14 00:00:33 +0530
commit428c2f36e5699ecda6ecb179ab3d87c373984998 (patch)
tree2120845c67e7b30dc810ec6ccc4213d360ed85ac /exam
parentfb7257f168f8e3187dccf0bb2d0ac88418028e17 (diff)
downloadonline_test-428c2f36e5699ecda6ecb179ab3d87c373984998.tar.gz
online_test-428c2f36e5699ecda6ecb179ab3d87c373984998.tar.bz2
online_test-428c2f36e5699ecda6ecb179ab3d87c373984998.zip
ENH: Prettifying error message and show username.
Diffstat (limited to 'exam')
-rw-r--r--exam/views.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/exam/views.py b/exam/views.py
index 1cf2480..560181a 100644
--- a/exam/views.py
+++ b/exam/views.py
@@ -122,12 +122,13 @@ def start(request):
return show_question(request, q)
def question(request, q_id):
+ user = request.user
q = get_object_or_404(Question, pk=q_id)
try:
quiz = Quiz.objects.get(user=request.user)
except Quiz.DoesNotExist:
redirect('/exam/start')
- context = {'question': q, 'quiz': quiz}
+ context = {'question': q, 'quiz': quiz, 'user': user}
ci = RequestContext(request)
return render_to_response('exam/question.html', context,
context_instance=ci)
@@ -158,7 +159,7 @@ def check(request, q_id):
ci = RequestContext(request)
if not success:
context = {'question': question, 'error_message': err_msg,
- 'last_attempt': answer}
+ 'quiz': quiz, 'last_attempt': answer}
return render_to_response('exam/question.html', context,
context_instance=ci)
else: