app/soc/views/models/club_app.py
changeset 893 2dba566e4bf8
parent 892 c3cdb581ffd2
child 894 11afeeba198c
equal deleted inserted replaced
892:c3cdb581ffd2 893:2dba566e4bf8
   125 
   125 
   126     if not is_developer:
   126     if not is_developer:
   127       # only select the applications for this user so construct a filter
   127       # only select the applications for this user so construct a filter
   128       filter['applicant'] = user_entity
   128       filter['applicant'] = user_entity
   129 
   129 
   130     # Get all the pending applications
   130     # get all the pending applications
   131 
   131 
   132     pa_params = params.copy() # pending applications
   132     pa_params = params.copy() # pending applications
   133 
   133 
   134     if is_developer:
   134     if is_developer:
   135       pa_params['list_description'] = ugettext_lazy(
   135       pa_params['list_description'] = ugettext_lazy(
   139           "An overview of your pending club applications.")
   139           "An overview of your pending club applications.")
   140 
   140 
   141     pa_list = list_helper.getListContent(
   141     pa_list = list_helper.getListContent(
   142         request, pa_params, filter, 0)
   142         request, pa_params, filter, 0)
   143 
   143 
   144     # Get all the reviewed applications now
   144     # get all the reviewed applications now
   145 
   145 
   146     # Re-use the old filter, but set to only reviewed and accepted
   146     # re-use the old filter, but set to only reviewed and accepted
   147     filter['status'] = 'accepted'
   147     filter['status'] = 'accepted'
   148 
   148 
   149     aa_params = params.copy() # accepted applications
   149     aa_params = params.copy() # accepted applications
   150 
   150 
   151     if is_developer:
   151     if is_developer:
   159     aa_params['list_action'] = (redirects.getApplicantRedirect, aa_params)
   159     aa_params['list_action'] = (redirects.getApplicantRedirect, aa_params)
   160 
   160 
   161     aa_list = list_helper.getListContent(
   161     aa_list = list_helper.getListContent(
   162         request, aa_params, filter, 1)
   162         request, aa_params, filter, 1)
   163 
   163 
   164     # Get all the reviewed applications that were denied
   164     # get all the reviewed applications that were denied
   165 
   165 
   166     # Re use the old filter, but this time only for denied apps
   166     # re use the old filter, but this time only for denied apps
   167     filter['status'] = 'rejected'
   167     filter['status'] = 'rejected'
   168 
   168 
   169     da_params = params.copy() # denied applications
   169     da_params = params.copy() # denied applications
   170 
   170 
   171     if is_developer:
   171     if is_developer:
   176           "An overview of your denied club applications.")
   176           "An overview of your denied club applications.")
   177 
   177 
   178     da_list = list_helper.getListContent(
   178     da_list = list_helper.getListContent(
   179         request, da_params, filter, 2)
   179         request, da_params, filter, 2)
   180 
   180 
   181     # fill contents with all the needed lists
       
   182     contents = [pa_list, aa_list, da_list]
   181     contents = [pa_list, aa_list, da_list]
       
   182 
       
   183     if is_developer:
       
   184       # re use the old filter, but this time only for ignored apps
       
   185       filter['status'] = 'ignored'
       
   186 
       
   187       ia_params = params.copy() # ignored applications
       
   188 
       
   189       ia_params['list_description'] = ugettext_lazy(
       
   190           "An overview of all ignored club applications.")
       
   191 
       
   192       ia_list = list_helper.getListContent(
       
   193           request, ia_params, filter, 2)
       
   194 
       
   195       contents += [ia_list]
   183 
   196 
   184     # call the _list method from base to display the list
   197     # call the _list method from base to display the list
   185     return self._list(request, params, contents, page_name)
   198     return self._list(request, params, contents, page_name)
   186 
   199 
   187   def _editGet(self, request, entity, form):
   200   def _editGet(self, request, entity, form):
   242 
   255 
   243       if status_value in ['accepted', 'rejected', 'ignored']:
   256       if status_value in ['accepted', 'rejected', 'ignored']:
   244         # this application has been properly reviewed update the status
   257         # this application has been properly reviewed update the status
   245         fields = {'status' : status_value}
   258         fields = {'status' : status_value}
   246 
   259 
   247         application = self._logic.getFromFields(link_id=kwargs['link_id'])
   260         self._logic.updateModelProperties(entity, fields)
   248         self._logic.updateModelProperties(application, fields)
   261         
       
   262         if status_value is 'accepted':
       
   263           # the application has been accepted send out a notification
       
   264           notifications.sendNewClubNotification(entity)
   249 
   265 
   250         return self.reviewOverview(request, access_type,
   266         return self.reviewOverview(request, access_type,
   251             page_name=page_name, params=params, **kwargs)
   267             page_name=page_name, params=params, **kwargs)
   252 
   268 
   253     # the application has not been reviewed so show the information
   269     # the application has not been reviewed so show the information
   287     uh_params ['list_action'] = (redirects.getReviewRedirect, params)
   303     uh_params ['list_action'] = (redirects.getReviewRedirect, params)
   288 
   304 
   289     uh_list = helper.lists.getListContent(
   305     uh_list = helper.lists.getListContent(
   290         request, uh_params, filter, 0)
   306         request, uh_params, filter, 0)
   291 
   307 
   292     #only select the requests the have been denied
   308     # only select the requests the have been rejected
   293     filter ['status'] = 'rejected'
   309     filter ['status'] = 'rejected'
   294 
   310 
   295     den_params = params.copy()
   311     den_params = params.copy()
   296     den_params['list_description'] = ugettext_lazy('A list of all applications '
   312     den_params['list_description'] = ugettext_lazy('A list of all applications '
   297         'that have been denied')
   313         'that have been ignored')
   298     den_params ['list_action'] = (redirects.getReviewRedirect, params)
   314     den_params ['list_action'] = (redirects.getReviewRedirect, params)
   299 
   315 
   300     den_list = helper.lists.getListContent(
   316     den_list = helper.lists.getListContent(
   301         request, den_params, filter, 0)
   317         request, den_params, filter, 0)
   302 
   318 
       
   319     # only select the request that have been ignored
       
   320     filter ['status'] = 'ignored'
       
   321 
       
   322     ign_params = params.copy()
       
   323     ign_params['list_description'] = ugettext_lazy('A list of all applications '
       
   324         'that have been ignored')
       
   325     ign_params ['list_action'] = (redirects.getReviewRedirect, params)
       
   326 
       
   327     ign_list = helper.lists.getListContent(
       
   328         request, ign_params, filter, 0)
       
   329 
   303     # fill contents with all the needed lists
   330     # fill contents with all the needed lists
   304     contents = [ur_list, uh_list, den_list]
   331     contents = [ur_list, uh_list, den_list, ign_list]
   305 
   332 
   306     # call the _list method from base to display the list
   333     # call the _list method from base to display the list
   307     return self._list(request, params, contents, page_name)
   334     return self._list(request, params, contents, page_name)
   308 
   335 
   309 view = View()
   336 view = View()