taskapp/views/task.py
changeset 64 e743fe1f0f99
parent 55 ca2486e29178
child 66 f670de53402b
equal deleted inserted replaced
63:1fc027bf99ee 64:e743fe1f0f99
    36     errors = []
    36     errors = []
    37     
    37     
    38     is_guest = True if not user.is_authenticated() else False
    38     is_guest = True if not user.is_authenticated() else False
    39     is_mentor = True if user in task.mentors.all() else False
    39     is_mentor = True if user in task.mentors.all() else False
    40     
    40     
    41     task_claimable = True if task.status in ["OP", "RE"] else False
    41     task_claimable = True if task.status in ["OP", "WR"] else False
    42     
    42     
    43     context = {'user':user,
    43     context = {'user':user,
    44                'task':task,
    44                'task':task,
    45                'comments':comments,
    45                'comments':comments,
    46                'mentors':mentors,
    46                'mentors':mentors,
    47                'is_guest':is_guest,
    47                'is_guest':is_guest,
    48                'is_mentor':is_mentor,
    48                'is_mentor':is_mentor,
    49                'errors':errors,
    49                'errors':errors,
    50                }
    50                }
    51                
    51                
    52     if task.status == "AS":
    52     assigned_users = task.assigned_users.all()
    53         context['assigned_user'] = task.assigned_users.all()[0]
    53     if assigned_users:
    54     
    54         context['assigned_users'] = assigned_users
       
    55    
    55     if request.method == 'POST':
    56     if request.method == 'POST':
    56         if not is_guest:
    57         if not is_guest:
    57             data = request.POST["data"]
    58             data = request.POST["data"]
    58             task = getTask(tid)
    59             task = getTask(tid)
    59             new_comment = Comment(task=task, data=data, created_by=user, creation_datetime=datetime.now())
    60             new_comment = Comment(task=task, data=data, created_by=user, creation_datetime=datetime.now())