app/soc/logic/cleaning.py
changeset 1755 972c546f0810
parent 1722 7f285e96cb17
child 1768 3177f83c1e50
equal deleted inserted replaced
1754:63fa0e7f8f47 1755:972c546f0810
   461       group_app_entity = group_app_logic.logic.getForFields(fields, unique=True)
   461       group_app_entity = group_app_logic.logic.getForFields(fields, unique=True)
   462 
   462 
   463       # get the current user
   463       # get the current user
   464       user_entity = user_logic.getForCurrentAccount()
   464       user_entity = user_logic.getForCurrentAccount()
   465 
   465 
   466       # make sure it's not the applicant creating the new group
   466       # if the proposal has not been accepted or it's not the applicant
   467       if group_app_entity and (
   467       # creating the new group then show link ID in use message
   468           group_app_entity.applicant.key() != user_entity.key()):
   468       if group_app_entity and (group_app_entity.status != 'accepted' or (
       
   469           group_app_entity.applicant.key() != user_entity.key())):
   469         # add the error message to the link id field
   470         # add the error message to the link id field
   470         self._errors[link_id_field] = ErrorList([DEF_LINK_ID_IN_USE_MSG])
   471         self._errors[link_id_field] = ErrorList([DEF_LINK_ID_IN_USE_MSG])
   471         del cleaned_data[link_id_field]
   472         del cleaned_data[link_id_field]
   472         # return the new cleaned_data
   473         # return the new cleaned_data
   473         return cleaned_data
   474         return cleaned_data