diff options
author | FOSSEE Project | 2014-06-29 16:20:36 +0530 |
---|---|---|
committer | FOSSEE Project | 2014-06-29 16:20:36 +0530 |
commit | add9e3f36254f578364c99d66c2eb9364e5aa3a5 (patch) | |
tree | f51d631216f00cd38c8f7aee8f10f9e4535bbd25 /testapp/exam/views.py | |
parent | 3c1880ffc5edc2d58f890cc32d36f1717082395a (diff) | |
download | online_test-add9e3f36254f578364c99d66c2eb9364e5aa3a5.tar.gz online_test-add9e3f36254f578364c99d66c2eb9364e5aa3a5.tar.bz2 online_test-add9e3f36254f578364c99d66c2eb9364e5aa3a5.zip |
changing moderator's landing page to show list of all quizzes
Diffstat (limited to 'testapp/exam/views.py')
-rw-r--r-- | testapp/exam/views.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/testapp/exam/views.py b/testapp/exam/views.py index c4c03df..c58ce89 100644 --- a/testapp/exam/views.py +++ b/testapp/exam/views.py @@ -569,15 +569,21 @@ def manual_questionpaper(request, questionpaper_id=None): def prof_manage(request): """Take credentials of the user with professor/moderator - rights/permissions and log in.""" +rights/permissions and log in.""" user = request.user - if user.is_authenticated()\ - and user.groups.filter(name='moderator').count() > 0: - context = {'user': user} + if user.is_authenticated() and is_moderator(user): + question_papers = QuestionPaper.objects.all() + users_per_paper = [] + for paper in question_papers: + answer_papers = AnswerPaper.objects.filter(question_paper=paper) + users_passed = AnswerPaper.objects.filter(question_paper=paper, passed=True).count() + users_failed = AnswerPaper.objects.filter(question_paper=paper, passed=False).count() + temp = paper, answer_papers, users_passed, users_failed + users_per_paper.append(temp) + context = {'user': user, 'users_per_paper':users_per_paper} return my_render_to_response('manage.html', context) return my_redirect('/exam/login/') - def user_login(request): """Take the credentials of the user and log the user in.""" |