taskapp/views/task.py
changeset 34 22f302094806
parent 33 0d0ea7b188d5
child 36 0f10deac0a9b
equal deleted inserted replaced
33:0d0ea7b188d5 34:22f302094806
   121         
   121         
   122         ## now iam going for a brute force method
   122         ## now iam going for a brute force method
   123         user_list = list(User.objects.all())
   123         user_list = list(User.objects.all())
   124         for mentor in task.mentors.all():
   124         for mentor in task.mentors.all():
   125             user_list.remove(mentor)
   125             user_list.remove(mentor)
       
   126             
       
   127         for a_user in task.claimed_users.all():
       
   128             user_list.remove(a_user)
       
   129             
   126         non_mentors = ((_.id,_.username) for _ in user_list)
   130         non_mentors = ((_.id,_.username) for _ in user_list)
       
   131         ## code till must be made elegant and not brute force like above
   127         
   132         
   128         form = AddMentorForm(non_mentors)
   133         form = AddMentorForm(non_mentors)
   129         if request.method == "POST":
   134         if request.method == "POST":
   130             uid = request.POST['mentor']
   135             uid = request.POST['mentor']
   131             new_mentor = User.objects.get(id=uid)
   136             new_mentor = User.objects.get(id=uid)