app/soc/views/models/student_proposal.py
changeset 2091 dd3eb2770205
parent 2076 1cd180cc56c9
child 2092 6de3693ba9d4
equal deleted inserted replaced
2090:a07ff1e1bd1f 2091:dd3eb2770205
   709     # to change his role for this app
   709     # to change his role for this app
   710     choice = get_dict.get('mentor')
   710     choice = get_dict.get('mentor')
   711     if mentor and choice:
   711     if mentor and choice:
   712       self._adjustPossibleMentors(entity, mentor, choice)
   712       self._adjustPossibleMentors(entity, mentor, choice)
   713 
   713 
   714     is_ineligible = get_dict.get('ineligible')
   714     ineligible = get_dict.get('ineligible')
   715     if org_admin and is_ineligible:
   715     
   716       # mark the proposal invalid and return to the list
   716     if org_admin:
   717       properties = {'status': 'invalid'}
   717       reviewer = org_admin
   718       self._logic.updateEntityProperties(entity, properties)
   718     elif mentor:
   719 
   719       reviewer = mentor
   720       redirect = redirects.getListProposalsRedirect(entity.org,
   720     
   721                                                     {'url_name': 'org'})
   721     if (org_admin or mentor) and ineligible != None:
   722       return http.HttpResponseRedirect(redirect)
   722       ineligible = int(ineligible)
       
   723       if ineligible == 1:
       
   724         # mark the proposal invalid and return to the list
       
   725         properties = {'status': 'invalid'}
       
   726         self._logic.updateEntityProperties(entity, properties)
       
   727 
       
   728         redirect = redirects.getListProposalsRedirect(entity.org,
       
   729                                                       {'url_name': 'org'})
       
   730         comment = "Marked Student Proposal as Ineligible."
       
   731         self._createReviewFor(entity, reviewer, comment, is_public=False)
       
   732         return http.HttpResponseRedirect(redirect)
       
   733       elif ineligible == 0:
       
   734         # mark the proposal as new and return to the list
       
   735         properties = {'status': 'new'}
       
   736         self._logic.updateEntityProperties(entity, properties)
       
   737 
       
   738         redirect = redirects.getListProposalsRedirect(entity.org,
       
   739                                                       {'url_name': 'org'})
       
   740         comment = "Marked Student Proposal as Eligible."
       
   741         self._createReviewFor(entity, reviewer, comment, is_public=False)
       
   742         return http.HttpResponseRedirect(redirect)
   723 
   743 
   724     # check if we should change the subscription state for the current user
   744     # check if we should change the subscription state for the current user
   725     public_subscription = None
   745     public_subscription = None
   726     private_subscription = None
   746     private_subscription = None
   727 
   747 
   860     context['private_reviews'] = review_logic.getReviewsForEntity(entity,
   880     context['private_reviews'] = review_logic.getReviewsForEntity(entity,
   861         is_public=False, order=order)
   881         is_public=False, order=order)
   862 
   882 
   863     # which button should we show to the mentor?
   883     # which button should we show to the mentor?
   864     if mentor:
   884     if mentor:
       
   885       context['is_mentor'] = True
   865       if mentor.key() in possible_mentors:
   886       if mentor.key() in possible_mentors:
   866         # show "No longer willing to mentor"
   887         # show "No longer willing to mentor"
   867         context['remove_me_as_mentor'] = True
   888         context['remove_me_as_mentor'] = True
   868       else:
   889       else:
   869         # show "I am willing to mentor"
   890         # show "I am willing to mentor"