diff options
author | Prabhu Ramachandran | 2011-11-17 17:35:30 +0530 |
---|---|---|
committer | Prabhu Ramachandran | 2011-11-17 17:35:30 +0530 |
commit | 9f674808a5681a0380531ff62079b94874641c1e (patch) | |
tree | 63fdb2f431d9fc68705e1170cc4e536a36c18169 /exam | |
parent | 78e18eae416a37fdb2e27d4dde7ed9675692ac7d (diff) | |
download | online_test-9f674808a5681a0380531ff62079b94874641c1e.tar.gz online_test-9f674808a5681a0380531ff62079b94874641c1e.tar.bz2 online_test-9f674808a5681a0380531ff62079b94874641c1e.zip |
BUG/ENH: Cleaning up page templates and fixing bug
If you complete the quiz it was going into a redirect loop, this is
fixed. Also cleaned up all the page templates with proper block
contents.
Diffstat (limited to 'exam')
-rw-r--r-- | exam/views.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/exam/views.py b/exam/views.py index ad8a04f..2437fba 100644 --- a/exam/views.py +++ b/exam/views.py @@ -94,8 +94,8 @@ def start(request): return complete(request, reason=msg) try: old_paper = QuestionPaper.objects.get(user=user, quiz=quiz) - p = old_paper.current_question() - return redirect('/exam/%s'%p) + q = old_paper.current_question() + return show_question(request, q) except QuestionPaper.DoesNotExist: ip = request.META['REMOTE_ADDR'] key = gen_key(10) @@ -198,11 +198,11 @@ def quit(request): def complete(request, reason=None): user = request.user - yes = True + no = False message = reason or 'The quiz has been completed. Thank you.' - if request.method == 'POST': - yes = request.POST.get('yes', None) - if yes: + if request.method == 'POST' and 'no' in request.POST: + no = request.POST.get('no', False) + if not no: # Logout the user and quit with the message given. logout(request) context = {'message': message} |