# HG changeset patch # User Madhusudan.C.S # Date 1296398085 -19800 # Node ID 56474add44b10a3900043a53814539bc6144bc27 # Parent c894de2932165f6eb03f210c8a377e3336da3d9a Allow editing of tasks even to coordinators and mentors. diff -r c894de293216 -r 56474add44b1 pytask/taskapp/views.py --- a/pytask/taskapp/views.py Sun Jan 30 20:03:48 2011 +0530 +++ b/pytask/taskapp/views.py Sun Jan 30 20:04:45 2011 +0530 @@ -172,6 +172,7 @@ 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 @@ 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 @@ user = request.user profile = user.get_profile() - can_create = True if profile.role != profile_models.ROLES_CHOICES[3][0] else False - if not can_create: - raise http.Http404 + if profile.role != profile_models.ROLES_CHOICES[3][0]: + can_create = True + else: + can_create= False - context = {"user": user, - "profile": profile, - } + if not can_create: + raise http.HttpResponseForbidden + + context = { + 'user': user, + 'profile': profile, + } context.update(csrf(request))