summaryrefslogtreecommitdiff
path: root/testapp/exam/views.py
diff options
context:
space:
mode:
authorprathamesh2014-07-03 17:35:01 +0530
committerprathamesh2014-07-03 17:35:01 +0530
commitaa80f512fbea42a1b78255254132fccf618030cf (patch)
tree6c134fc6e71b66d2ee6a0f4da88b3b9cc6666713 /testapp/exam/views.py
parent3918842683580a7265e4420febb13aadf7604e35 (diff)
downloadonline_test-aa80f512fbea42a1b78255254132fccf618030cf.tar.gz
online_test-aa80f512fbea42a1b78255254132fccf618030cf.tar.bz2
online_test-aa80f512fbea42a1b78255254132fccf618030cf.zip
Whitespaces stripped
Diffstat (limited to 'testapp/exam/views.py')
-rw-r--r--testapp/exam/views.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/testapp/exam/views.py b/testapp/exam/views.py
index 2eb6dd4..bee617d 100644
--- a/testapp/exam/views.py
+++ b/testapp/exam/views.py
@@ -133,32 +133,32 @@ def user_register(request):
context_instance=ci)
-def quizlist_user(request):
- """Show All Quizzes that is available to logged-in user."""
- user = request.user
- avail_quizzes = list(QuestionPaper.objects.filter(quiz__active=True))
- user_answerpapers = AnswerPaper.objects.filter(user=user)
- quizzes_taken = []
+def quizlist_user(request):
+ """Show All Quizzes that is available to logged-in user."""
+ user = request.user
+ avail_quizzes = list(QuestionPaper.objects.filter(quiz__active=True))
+ user_answerpapers = AnswerPaper.objects.filter(user=user)
+ quizzes_taken = []
pre_requisites = []
- context = {}
-
+ context = {}
+
if 'cannot_attempt' in request.GET:
context['cannot_attempt'] = True
-
- if user_answerpapers.count() == 0:
+
+ if user_answerpapers.count() == 0:
context['quizzes'] = avail_quizzes
- context['user'] = user
+ context['user'] = user
context['quizzes_taken'] = None
- return my_render_to_response("exam/quizzes_user.html", context)
-
- for answer_paper in user_answerpapers:
- for quiz in avail_quizzes:
+ return my_render_to_response("exam/quizzes_user.html", context)
+
+ for answer_paper in user_answerpapers:
+ for quiz in avail_quizzes:
if answer_paper.question_paper.id == quiz.id and \
- answer_paper.end_time != answer_paper.start_time:
+ answer_paper.end_time != answer_paper.start_time:
avail_quizzes.remove(quiz)
- quizzes_taken.append(answer_paper)
-
+ quizzes_taken.append(answer_paper)
+
context['quizzes'] = avail_quizzes
context['user'] = user
context['quizzes_taken'] = quizzes_taken
@@ -183,7 +183,7 @@ def intro(request, questionpaper_id):
else:
context = {'user': user, 'cannot_attempt':True}
return my_redirect("/exam/quizzes/?cannot_attempt=True")
-
+
except:
context = {'user': user, 'cannot_attempt':True}
return my_redirect("/exam/quizzes/?cannot_attempt=True")