diff options
author | nishanth | 2010-02-24 16:47:09 +0530 |
---|---|---|
committer | nishanth | 2010-02-24 16:47:09 +0530 |
commit | fa1f14ca448e02e997ac1c1b8d1075b2596bb212 (patch) | |
tree | 0934cab65a9e0d6c46d280ef3c95acce3a8894ca /taskapp/views | |
parent | 93db3491fd51a5b472b885dbf44534425289037a (diff) | |
download | pytask-fa1f14ca448e02e997ac1c1b8d1075b2596bb212.tar.gz pytask-fa1f14ca448e02e997ac1c1b8d1075b2596bb212.tar.bz2 pytask-fa1f14ca448e02e997ac1c1b8d1075b2596bb212.zip |
fixed a bug in add_claim view in views/task .
Diffstat (limited to 'taskapp/views')
-rw-r--r-- | taskapp/views/task.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/taskapp/views/task.py b/taskapp/views/task.py index 0cbc3c9..d81983a 100644 --- a/taskapp/views/task.py +++ b/taskapp/views/task.py @@ -128,12 +128,15 @@ def add_mentor(request, tid): if (not is_guest) and user in task.mentors.all(): ## now iam going for a brute force method - user_list = list(User.objects.all()) + user_list = list(User.objects.filter(is_active=True)) for mentor in task.mentors.all(): user_list.remove(mentor) for a_user in task.claimed_users.all(): user_list.remove(a_user) + + for a_user in task.assigned_users.all(): + user_list.remove(a_user) non_mentors = ((_.id,_.username) for _ in user_list) ## code till must be made elegant and not brute force like above @@ -196,12 +199,13 @@ def claim_task(request, tid): mentors = task.mentors.all() claimed_users = task.claimed_users.all() + assigned_users = task.assigned_users.all() is_guest = True if not user.is_authenticated() else False is_mentor = True if user in mentors else False task_claimable = True if task.status in ["OP", "WR"] else False - user_can_claim = True if task_claimable and not ( is_guest or is_mentor ) and ( user not in claimed_users ) else False + user_can_claim = True if task_claimable and not ( is_guest or is_mentor ) and ( user not in claimed_users ) and ( user not in assigned_users ) else False task_claimed = True if claimed_users else False context = {'user':user, |