diff options
author | prathamesh | 2014-07-03 17:35:01 +0530 |
---|---|---|
committer | prathamesh | 2014-07-03 17:35:01 +0530 |
commit | aa80f512fbea42a1b78255254132fccf618030cf (patch) | |
tree | 6c134fc6e71b66d2ee6a0f4da88b3b9cc6666713 /testapp/exam | |
parent | 3918842683580a7265e4420febb13aadf7604e35 (diff) | |
download | online_test-aa80f512fbea42a1b78255254132fccf618030cf.tar.gz online_test-aa80f512fbea42a1b78255254132fccf618030cf.tar.bz2 online_test-aa80f512fbea42a1b78255254132fccf618030cf.zip |
Whitespaces stripped
Diffstat (limited to 'testapp/exam')
-rw-r--r-- | testapp/exam/urls.py | 10 | ||||
-rw-r--r-- | testapp/exam/views.py | 38 |
2 files changed, 24 insertions, 24 deletions
diff --git a/testapp/exam/urls.py b/testapp/exam/urls.py index 3950a43..b659cf6 100644 --- a/testapp/exam/urls.py +++ b/testapp/exam/urls.py @@ -9,7 +9,7 @@ urlpatterns = patterns('exam.views', url(r'^start/(?P<questionpaper_id>\d+)/$','start'), url(r'^quit/(?P<questionpaper_id>\d+)/$', 'quit'), url(r'^intro/(?P<questionpaper_id>\d+)/$','intro'), - url(r'^complete/$', 'complete'), + url(r'^complete/$', 'complete'), url(r'^complete/(?P<questionpaper_id>\d+)/$', 'complete'), url(r'^register/$', 'user_register'), url(r'^(?P<q_id>\d+)/$', 'question'), @@ -19,7 +19,7 @@ urlpatterns = patterns('exam.views', url(r'^manage/$', 'prof_manage'), url(r'^manage/addquestion/$', 'add_question'), - url(r'^manage/addquestion/(?P<question_id>\d+)/$', 'add_question'), + url(r'^manage/addquestion/(?P<question_id>\d+)/$', 'add_question'), url(r'^manage/addquiz/$', 'add_quiz'), url(r'^manage/editquiz/$', 'edit_quiz'), url(r'^manage/editquestion/$', 'edit_question'), @@ -27,12 +27,12 @@ urlpatterns = patterns('exam.views', url(r'^manage/gradeuser/$', 'show_all_users'), url(r'^manage/gradeuser/(?P<username>[a-zA-Z0-9_.]+)/$', 'grade_user'), url(r'^manage/questions/$', 'show_all_questions'), - url(r'^manage/showquiz/$','show_all_quiz'), + url(r'^manage/showquiz/$','show_all_quiz'), url(r'^manage/monitor/$', 'monitor'), - url(r'^manage/showquestionpapers/$','show_all_questionpapers'), + url(r'^manage/showquestionpapers/$','show_all_questionpapers'), url(r'^manage/showquestionpapers/(?P<questionpaper_id>\d+)/$',\ 'show_all_questionpapers'), - url(r'^manage/monitor/(?P<questionpaper_id>\d+)/$', 'monitor'), + url(r'^manage/monitor/(?P<questionpaper_id>\d+)/$', 'monitor'), url(r'^manage/user_data/(?P<username>[a-zA-Z0-9_.]+)/$','user_data'), url(r'^manage/designquestionpaper/$','design_questionpaper'), url(r'^manage/designquestionpaper/(?P<questionpaper_id>\d+)/$',\ 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") |