app/soc/logic/cleaning.py
changeset 1143 b07b7d5b3e27
parent 1088 7ad48d59da3d
child 1205 2e88261aba72
equal deleted inserted replaced
1142:da2487767ef4 1143:b07b7d5b3e27
    77     raise forms.ValidationError(
    77     raise forms.ValidationError(
    78         'The site-wide Terms of Service must be accepted to participate'
    78         'The site-wide Terms of Service must be accepted to participate'
    79         ' on this site.')
    79         ' on this site.')
    80 
    80 
    81   return wrapper
    81   return wrapper
       
    82 
    82 
    83 
    83 def clean_existing_user(field_name):
    84 def clean_existing_user(field_name):
    84   """Check if the field_name field is a valid user.
    85   """Check if the field_name field is a valid user.
    85   """
    86   """
    86 
    87 
   209       # validate the link_id
   210       # validate the link_id
   210       club_link_id = clean_link_id(field_name)(self)
   211       club_link_id = clean_link_id(field_name)(self)
   211 
   212 
   212       # check if there is already an application with the given link_id
   213       # check if there is already an application with the given link_id
   213       fields = {'link_id': club_link_id,
   214       fields = {'link_id': club_link_id,
   214                 'status': ['accepted','ignored','needs review','completed']}
   215                 'status': ['accepted', 'ignored', 'needs review', 'completed']}
   215       club_app_entity = club_app_logic.logic.getForFields(fields, unique=True)
   216       club_app_entity = club_app_logic.logic.getForFields(fields, unique=True)
   216 
   217 
   217       if club_app_entity:
   218       if club_app_entity:
   218         raise forms.ValidationError(
   219         raise forms.ValidationError(
   219             ugettext('This link ID is already in use, please specify another one'))
   220             ugettext('This link ID is already in use, please specify another one'))