# HG changeset patch # User nishanth # Date 1267010229 -19800 # Node ID 00a41fbf49582844d6f134ea62f72d007f9e70e3 # Parent fa59955a340bf19da2e484177dfbcef532704997 fixed a bug in add_claim view in views/task . diff -r fa59955a340b -r 00a41fbf4958 taskapp/views/task.py --- a/taskapp/views/task.py Wed Feb 24 16:35:09 2010 +0530 +++ b/taskapp/views/task.py Wed Feb 24 16:47:09 2010 +0530 @@ -128,12 +128,15 @@ 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 @@ 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, diff -r fa59955a340b -r 00a41fbf4958 templates/task/view.html --- a/templates/task/view.html Wed Feb 24 16:35:09 2010 +0530 +++ b/templates/task/view.html Wed Feb 24 16:47:09 2010 +0530 @@ -13,7 +13,9 @@ {{mentor.username}}| {% endfor %} {% if can_mod_mentors %} - Add another Mentor to this task
+ Add another Mentor to this task + Remove a mentor +
edit task goes here and it should contain all those add subs and add deps depending on availability
{% endif %}