taskapp/views/task.py
changeset 180 972745147e3f
parent 179 8d1fdb148c27
child 181 be8ad7e26176
equal deleted inserted replaced
179:8d1fdb148c27 180:972745147e3f
   150                 form = TaskCreateForm()
   150                 form = TaskCreateForm()
   151                 return render_to_response('task/create.html',{'user':user, 'form':form})
   151                 return render_to_response('task/create.html',{'user':user, 'form':form})
   152         else:
   152         else:
   153             return show_msg(user, 'You are not authorised to create a task.')
   153             return show_msg(user, 'You are not authorised to create a task.')
   154     else:
   154     else:
   155         return show_msg(user, 'You are not authorised to create a task.')
   155         return show_msg(user, 'You are not authorised to create a task.', "/", "home page")
   156         
   156         
   157 def add_mentor(request, tid):
   157 def add_mentor(request, tid):
   158     """ check if the current user has the rights to edit the task and add him.
   158     """ check if the current user has the rights to edit the task and add him.
   159     if user is not authenticated, redirect him to concerned page. """
   159     if user is not authenticated, redirect him to concerned page. """
   160     
   160     
   519 def edit_task(request, tid):
   519 def edit_task(request, tid):
   520     """ see what are the attributes that can be edited depending on the current status
   520     """ see what are the attributes that can be edited depending on the current status
   521     and then give the user fields accordingly.
   521     and then give the user fields accordingly.
   522     """
   522     """
   523     
   523     
   524     task = Task.objects.get(id=tid)
   524     task = getTask(tid)
       
   525 
   525     task_url = "/task/view/tid=%s"%tid
   526     task_url = "/task/view/tid=%s"%tid
   526     user = get_user(request.user) if request.user.is_authenticated() else request.user
   527     user = get_user(request.user) if request.user.is_authenticated() else request.user
   527 
   528 
   528     is_mentor = True if user in task.mentors.all() else False
   529     is_mentor = True if user in task.mentors.all() else False
   529     can_edit = True if is_mentor and task.status == "UP" else False
   530     can_edit = True if is_mentor and task.status == "UP" else False