pytask/taskapp/views/task.py
changeset 550 a606a40584f7
parent 545 3a86d85333a3
child 556 a0e57ca7cf56
equal deleted inserted replaced
549:3e8fc2ba0bde 550:a606a40584f7
     2 
     2 
     3 If there is something common to all other views. They sit here, here
     3 If there is something common to all other views. They sit here, here
     4 even if there nothing relevant to tasks alone since task is the basis
     4 even if there nothing relevant to tasks alone since task is the basis
     5 for everything else.
     5 for everything else.
     6 """
     6 """
       
     7 
     7 
     8 
     8 __authors__ = [
     9 __authors__ = [
     9     '"Nishanth Amuluru" <nishanth@fossee.in>',
    10     '"Nishanth Amuluru" <nishanth@fossee.in>',
    10     '"Madhusudan.C.S" <madhusudancs@fossee.in>',
    11     '"Madhusudan.C.S" <madhusudancs@fossee.in>',
    11     ]
    12     ]
   146         context.update(kwargs['context'])
   147         context.update(kwargs['context'])
   147 
   148 
   148     # TODO(disable): Disable once the tasks can be claimed
   149     # TODO(disable): Disable once the tasks can be claimed
   149     context['uberbar_message'] = DONT_CLAIM_TASK_MSG
   150     context['uberbar_message'] = DONT_CLAIM_TASK_MSG
   150 
   151 
   151     task_url = reverse('view_task', kwargs={'task_id': task_id})
   152     task_url = kwargs.get(
       
   153       'task_url', reverse('view_task', kwargs={'task_id': task_id}))
       
   154 
   152     task = shortcuts.get_object_or_404(taskapp_models.Task, pk=task_id)
   155     task = shortcuts.get_object_or_404(taskapp_models.Task, pk=task_id)
   153 
   156 
   154     user = request.user
   157     user = request.user
   155 
   158 
   156     if not user.is_authenticated():
   159     if not user.is_authenticated():
   267         context['form'] = form
   270         context['form'] = form
   268         return shortcuts.render_to_response(
   271         return shortcuts.render_to_response(
   269           'task/view.html', RequestContext(request, context))
   272           'task/view.html', RequestContext(request, context))
   270 
   273 
   271 @login_required
   274 @login_required
   272 def edit_task(request, task_id):
   275 def edit_task(request, task_id, **kwargs):
   273     """ only creator gets to edit the task and that too only before it gets
   276     """ only creator gets to edit the task and that too only before it gets
   274     approved.
   277     approved.
   275     """
   278     """
   276 
   279 
   277     user = request.user
   280     user = request.user
   278     profile = user.get_profile()
   281     profile = user.get_profile()
   279 
   282 
   280     task_url = reverse('view_task', kwargs={'task_id': task_id})
   283     task_url = kwargs.get(
       
   284       'task_url', reverse('view_task', kwargs={'task_id': task_id}))
   281     task = shortcuts.get_object_or_404(taskapp_models.Task, pk=task_id)
   285     task = shortcuts.get_object_or_404(taskapp_models.Task, pk=task_id)
   282 
   286 
   283     is_creator = True if user == task.created_by else False
   287     is_creator = True if user == task.created_by else False
   284 
   288 
   285     if ((is_creator or profile.role != profile_models.ROLES_CHOICES[3][0])
   289     if ((is_creator or profile.role != profile_models.ROLES_CHOICES[3][0])