app/soc/views/models/club_app.py
changeset 1083 b8018d7a9f23
parent 1081 81cf69225a24
child 1085 0afbdd0905ef
--- a/app/soc/views/models/club_app.py	Fri Jan 30 11:30:43 2009 +0000
+++ b/app/soc/views/models/club_app.py	Fri Jan 30 11:46:08 2009 +0000
@@ -82,7 +82,8 @@
               ),
         'clean_backup_admin_link_id': 
             cleaning.clean_users_not_same('backup_admin_link_id'),
-        'clean_link_id' : self.clean_club_app_link_id('link_id')
+        'clean_link_id': cleaning.clean_new_club_link_id('link_id', 
+            model_logic.club, club_app_logic)
         }
 
     new_params['edit_extra_dynafields'] = {
@@ -343,34 +344,6 @@
     # call the _list method from base to display the list
     return self._list(request, params, contents, page_name)
 
-  def clean_club_app_link_id(self, field_name):
-    """Cleans the link_id in the club application form
-    """
-    def wrapper(self):
-      # validate the link_id
-      club_link_id = cleaning.clean_link_id(field_name)(self)
-
-      # check if there is already an application with the given link_id
-      fields = {'link_id': club_link_id,
-                'state': ['accepted','ignored','needs review','completed']}
-      club_app_entity = club_app_logic.logic.getForFields(fields, unique=True)
-
-      if club_app_entity:
-        raise forms.ValidationError(
-            ugettext('This link ID is already in use, please specify another one'))
-
-      # check if there is already a club with the given link_id
-      fields['state'] = ['new', 'active', 'inactive']
-      club_logic = model_logic.club
-      club_entity = club_logic.logic.getForFields(fields, unique=True)
-
-      if club_entity:
-        raise forms.ValidationError(
-            ugettext('This link ID is already in use, please specify another one'))
-
-      return club_link_id
-    return wrapper
-
 
 view = View()