diff options
author | Nishanth Amuluru | 2011-11-10 20:25:03 +0530 |
---|---|---|
committer | Nishanth Amuluru | 2011-11-10 20:50:26 +0530 |
commit | 5b2d3d506e277d57bae9a8b90dd348225347d486 (patch) | |
tree | b4fb4fcff86354c3f2f4e092275e1de4a72fcbda /exam/views.py | |
parent | aeb50765bdcb5e94bcd07d22f2cfa8f692e13911 (diff) | |
download | online_test-5b2d3d506e277d57bae9a8b90dd348225347d486.tar.gz online_test-5b2d3d506e277d57bae9a8b90dd348225347d486.tar.bz2 online_test-5b2d3d506e277d57bae9a8b90dd348225347d486.zip |
Now the users cannot retake the test once they logout.
Diffstat (limited to 'exam/views.py')
-rw-r--r-- | exam/views.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/exam/views.py b/exam/views.py index d8a0a45..43ac388 100644 --- a/exam/views.py +++ b/exam/views.py @@ -88,6 +88,8 @@ def start(request): user = request.user try: old_quiz = Quiz.objects.get(user=user) + if not old_quiz.is_active: + return redirect("/exam/complete/") q = old_quiz.current_question() return redirect('/exam/%s'%q) except Quiz.DoesNotExist: @@ -186,10 +188,14 @@ def quit(request): context_instance=RequestContext(request)) def complete(request): + user = request.user yes = True if request.method == 'POST': yes = request.POST.get('yes', None) if yes: + quiz = Quiz.objects.get(user=user) + quiz.is_active = False + quiz.save() logout(request) return render_to_response('exam/complete.html') else: |