taskapp/views/task.py
changeset 192 8c982f517786
parent 191 3bfe70742aa8
child 193 505bbe421be4
equal deleted inserted replaced
191:3bfe70742aa8 192:8c982f517786
    80                'is_mentor':is_mentor,
    80                'is_mentor':is_mentor,
    81               }
    81               }
    82 
    82 
    83     claimed_users = task.claimed_users.all()
    83     claimed_users = task.claimed_users.all()
    84 
    84 
    85     task_viewable = True if ( task.status != "UP" ) or is_mentor or user.request_sent_to.filter(is_valid=True,is_replied=False,role="MT",task=task)else False 
    85 
       
    86     is_requested_mentor = True if user.request_sent_to.filter(is_valid=True,is_replied=False,role="MT",task=task) else False
       
    87     task_viewable = True if ( task.status != "UP" ) or is_mentor or is_requested_mentor else False
    86     if not task_viewable:
    88     if not task_viewable:
    87         return show_msg(user, "You are not authorised to view this task", "/task/browse/", "browse the tasks")
    89         return show_msg(user, "You are not authorised to view this task", "/task/browse/", "browse the tasks")
       
    90 
       
    91     context['is_requested_mentor'] = is_requested_mentor
    88 
    92 
    89     context['can_publish'] = True if task.status == "UP" and user == task.created_by else False
    93     context['can_publish'] = True if task.status == "UP" and user == task.created_by else False
    90     context['can_edit'] = True if task.status == "UP" and is_mentor else False
    94     context['can_edit'] = True if task.status == "UP" and is_mentor else False
    91     context['can_close'] = True if task.status not in ["UP", "CD", "CM"] and is_mentor else False
    95     context['can_close'] = True if task.status not in ["UP", "CD", "CM"] and is_mentor else False
    92     context['can_delete'] = True if task.status == "UP" and user == task.created_by else False
    96     context['can_delete'] = True if task.status == "UP" and user == task.created_by else False