equal
deleted
inserted
replaced
187 else: |
187 else: |
188 is_mentor = False |
188 is_mentor = False |
189 |
189 |
190 task_claimable = True if task.status in ["OP", "RE", "CL"] else False |
190 task_claimable = True if task.status in ["OP", "RE", "CL"] else False |
191 user_can_claim = True if task_claimable and not ( is_guest or is_mentor ) and ( user not in task.claimed_users.all() ) else False |
191 user_can_claim = True if task_claimable and not ( is_guest or is_mentor ) and ( user not in task.claimed_users.all() ) else False |
|
192 task_claimed = True if task.status == "CL" else False |
192 |
193 |
193 context = {'is_mentor':is_mentor, |
194 context = {'is_mentor':is_mentor, |
194 'task':task, |
195 'task':task, |
195 'claims':claims, |
196 'claims':claims, |
196 'user_can_claim':user_can_claim, |
197 'user_can_claim':user_can_claim, |
197 'task_claimable':task_claimable, |
198 'task_claimable':task_claimable, |
|
199 'task_claimed':task_claimed, |
198 'errors':errors} |
200 'errors':errors} |
199 |
201 |
200 if not is_guest: |
202 if not is_guest: |
201 if request.method == "POST": |
203 if request.method == "POST": |
202 claim_proposal = request.POST['message'] |
204 claim_proposal = request.POST['message'] |
237 assigned_user = User.objects.get(id=uid) |
239 assigned_user = User.objects.get(id=uid) |
238 assignTask(task, assigned_user) |
240 assignTask(task, assigned_user) |
239 return redirect(task_url) |
241 return redirect(task_url) |
240 else: |
242 else: |
241 return render_to_response('task/assign.html',{'form':form}) |
243 return render_to_response('task/assign.html',{'form':form}) |
242 else: |
244 elif task.status == "AS": |
243 return show_msg('The task is already assigned', task_url, 'view the task') |
245 return show_msg('The task is already assigned', task_url, 'view the task') |
|
246 elif task.status == "OP": |
|
247 return show_msg('No one has still claimed the task', task_url, 'view the task') |
|
248 else: |
|
249 return show_msg('The task status is %s. how can you assign it now'%task.status, task_url, 'view the task') |
244 else: |
250 else: |
245 return show_msg('You are not authorised to perform this action', task_url, 'view the task') |
251 return show_msg('You are not authorised to perform this action', task_url, 'view the task') |
246 |
252 |
247 |
253 |