From 69a07a92309105b289f4d08957729bda68727bf2 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Thu, 5 Jul 2018 17:46:00 +0530 Subject: - Add buttons to Moderator and Student templates - Modify _add_to_moderator function to _toggle_moderator_function in order to allow addition and removal of moderator group link --- yaksh/views.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'yaksh/views.py') diff --git a/yaksh/views.py b/yaksh/views.py index 7cfb03f..bda2774 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -66,7 +66,7 @@ def my_render_to_response(request, template, context=None, **kwargs): def is_moderator(user, group_name='moderator'): """Check if the user is having moderator rights""" try: - group = Group.objects.get(name='moderator') + group = Group.objects.get(name=group_name) return user.profile.is_moderator and user in group.user_set.all() except Profile.DoesNotExist: return False @@ -172,8 +172,10 @@ def quizlist_user(request, enrolled=None, msg=None): ) title = 'All Courses' - context = {'user': user, 'courses': courses, 'title': title, - 'msg': msg} + context = { + 'user': user, 'courses': courses, + 'title': title, 'msg': msg + } return my_render_to_response(request, "yaksh/quizzes_user.html", context) -- cgit