app/soc/views/models/student_project.py
changeset 2281 a702d92a57a6
parent 2280 157f6b8de010
child 2330 068540d91bde
equal deleted inserted replaced
2280:157f6b8de010 2281:a702d92a57a6
   245 
   245 
   246       additional_mentors = entity.additional_mentors
   246       additional_mentors = entity.additional_mentors
   247       if additional_mentors and mentor.key() in additional_mentors:
   247       if additional_mentors and mentor.key() in additional_mentors:
   248         # remove the mentor from the additional mentors list
   248         # remove the mentor from the additional mentors list
   249         additional_mentors.remove(mentor.key())
   249         additional_mentors.remove(mentor.key())
   250         fields= {'additional_mentors': additional_mentors}
   250         fields = {'additional_mentors': additional_mentors}
   251         project_logic.updateEntityProperties(entity, fields)
   251         project_logic.updateEntityProperties(entity, fields)
   252 
   252 
   253       # redirect to the same page without GET arguments
   253       # redirect to the same page without GET arguments
   254       redirect = request.path
   254       redirect = request.path
   255       return http.HttpResponseRedirect(redirect)
   255       return http.HttpResponseRedirect(redirect)
   304     context['additional_mentors'] = additional_mentors_context
   304     context['additional_mentors'] = additional_mentors_context
   305 
   305 
   306     # all mentors who are not already an additional mentor or
   306     # all mentors who are not already an additional mentor or
   307     # the primary mentor are allowed to become an additional mentor
   307     # the primary mentor are allowed to become an additional mentor
   308     possible_additional_mentors = [m for m in mentors if 
   308     possible_additional_mentors = [m for m in mentors if 
   309         (m.key() not in additional_mentors) and (m.key() != entity.mentor.key())]
   309         (m.key() not in additional_mentors) 
       
   310         and (m.key() != entity.mentor.key())]
   310 
   311 
   311     # create the information to be shown on the additional mentor form
   312     # create the information to be shown on the additional mentor form
   312     additional_mentor_choices = [
   313     additional_mentor_choices = [
   313         (mentor.link_id,'%s (%s)' %(mentor.name(), mentor.link_id))
   314         (mentor.link_id,'%s (%s)' %(mentor.name(), mentor.link_id))
   314         for mentor in possible_additional_mentors]
   315         for mentor in possible_additional_mentors]
   421 
   422 
   422     # redirect to the same page
   423     # redirect to the same page
   423     redirect = request.path
   424     redirect = request.path
   424     return http.HttpResponseRedirect(redirect)
   425     return http.HttpResponseRedirect(redirect)
   425 
   426 
   426   def _manageAddAdditionalMentor(self, request, template, context, params, entity, form):
   427   def _manageAddAdditionalMentor(self, request, template, 
       
   428                                  context, params, entity, form):
   427     """Handles the POST request for changing a Projects's additional mentors.
   429     """Handles the POST request for changing a Projects's additional mentors.
   428 
   430 
   429     Args:
   431     Args:
   430         template: the template used for this view
   432         template: the template used for this view
   431         entity: the student project entity
   433         entity: the student project entity