summaryrefslogtreecommitdiff
path: root/taskapp/views/task.py
diff options
context:
space:
mode:
authornishanth2010-03-01 05:18:44 +0530
committernishanth2010-03-01 05:18:44 +0530
commitc3066d484e0934ed328b83974b01abb93a62fce1 (patch)
tree1dc2483e239d0280c64d01f593d1397ccf333e46 /taskapp/views/task.py
parentd4f962bee5bbdc6c8892c330e71dd104ff2dbb20 (diff)
downloadpytask-c3066d484e0934ed328b83974b01abb93a62fce1.tar.gz
pytask-c3066d484e0934ed328b83974b01abb93a62fce1.tar.bz2
pytask-c3066d484e0934ed328b83974b01abb93a62fce1.zip
removing user deletes all the pending requests that request giving him pynts.
Diffstat (limited to 'taskapp/views/task.py')
-rw-r--r--taskapp/views/task.py39
1 files changed, 22 insertions, 17 deletions
diff --git a/taskapp/views/task.py b/taskapp/views/task.py
index de4e486..ba71569 100644
--- a/taskapp/views/task.py
+++ b/taskapp/views/task.py
@@ -378,26 +378,30 @@ def rem_user(request, tid):
'user':user,
'task':task,
}
-
- if assigned_users:
- form = RemoveUserForm(choices)
- context['form'] = form
- if request.method == "POST":
- data = request.POST
- form = RemoveUserForm(choices, data)
- if form.is_valid():
- data = form.cleaned_data
- uid = data['user']
- rem_user = User.objects.get(id=uid)
- removeUser(task, rem_user, user)
- return redirect(task_url)
+
+ if task.status in ["OP", "WR"]:
+ if assigned_users:
+ form = RemoveUserForm(choices)
+ context['form'] = form
+ if request.method == "POST":
+ data = request.POST
+ form = RemoveUserForm(choices, data)
+ if form.is_valid():
+ data = form.cleaned_data
+ uid = data['user']
+ reason = data['reason']
+ rem_user = User.objects.get(id=uid)
+ removeUser(task, rem_user, user, reason)
+ return redirect(task_url)
+ else:
+ context['form'] = form
+ return render_to_response('task/remove_user.html', context)
else:
- context['form'] = form
- return render_to_response('task/remove_user.html', context)
+ return render_to_response('task/remove_user.html',context)
else:
- return render_to_response('task/remove_user.html',context)
+ return show_msg(user, "There is no one working on this task to be kicked off", task_url, "view the task")
else:
- return show_msg(user, "There is no one working on this task to be kicked off", task_url, "view the task")
+ return show_msg(user, "This is not the stage to remove users", task_url, "view the task")
else:
return show_msg(user, "You are not authorised to do this", task_url, "view the task")
@@ -454,6 +458,7 @@ def assign_credits(request, tid):
task = getTask(tid)
## the moment we see that user had requested credits, it means he had worked and hence we change the status to WR
+ ## we have to discuss on this since, credits may also be given to mentor
task.status = "WR"
task.save()