diff options
author | Madhusudan.C.S | 2011-01-30 20:04:45 +0530 |
---|---|---|
committer | Madhusudan.C.S | 2011-01-30 20:04:45 +0530 |
commit | 2a4114e2a438b27c66c65bbeabb8750b704d943a (patch) | |
tree | 52c3bc11f2731818b7320263ce7ecdf89fcd5b54 | |
parent | f74720a68705851cf4c5df9073d1c591fdbc5ffb (diff) | |
download | pytask-2a4114e2a438b27c66c65bbeabb8750b704d943a.tar.gz pytask-2a4114e2a438b27c66c65bbeabb8750b704d943a.tar.bz2 pytask-2a4114e2a438b27c66c65bbeabb8750b704d943a.zip |
Allow editing of tasks even to coordinators and mentors.
-rwxr-xr-x | pytask/taskapp/views.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/pytask/taskapp/views.py b/pytask/taskapp/views.py index 1418616..4d1d4bf 100755 --- a/pytask/taskapp/views.py +++ b/pytask/taskapp/views.py @@ -172,6 +172,7 @@ def view_task(request, task_id): selected_users = task.selected_users.all() + user_role = user.get_profile().role is_creator = True if user == task.created_by else False context['selected_users'] = selected_users @@ -185,7 +186,8 @@ def view_task(request, task_id): else: context['can_approve'] = False - if is_creator and task.status == taskapp_models.TASK_STATUS_CHOICES[0][0]: + if ((is_creator or user_role != profile_models.ROLES_CHOICES[3][0]) + and task.status == taskapp_models.TASK_STATUS_CHOICES[0][0]): context['can_edit'] = True else: context['can_edit'] = False @@ -489,13 +491,18 @@ def create_textbook(request): user = request.user profile = user.get_profile() - can_create = True if profile.role != profile_models.ROLES_CHOICES[3][0] else False + if profile.role != profile_models.ROLES_CHOICES[3][0]: + can_create = True + else: + can_create= False + if not can_create: - raise http.Http404 + raise http.HttpResponseForbidden - context = {"user": user, - "profile": profile, - } + context = { + 'user': user, + 'profile': profile, + } context.update(csrf(request)) |