app/soc/views/models/program.py
changeset 2410 cb136ce6c8d1
parent 2361 40b0c25a5793
child 2437 32620683a7a6
equal deleted inserted replaced
2409:5ffa2372f1d6 2410:cb136ce6c8d1
   281     return self._list(request, params, contents, page_name)
   281     return self._list(request, params, contents, page_name)
   282 
   282 
   283   @decorators.merge_params
   283   @decorators.merge_params
   284   @decorators.check_access
   284   @decorators.check_access
   285   def acceptedProjects(self, request, access_type,
   285   def acceptedProjects(self, request, access_type,
   286 		       page_name=None, params=None, filter=None, **kwargs):
   286                        page_name=None, params=None, filter=None, **kwargs):
   287     """See base.View.list.
   287     """See base.View.list.
   288     """
   288     """
   289     contents = []
   289     contents = []
   290     logic = params['logic']
   290     logic = params['logic']
   291 
   291 
   292     program_entity = logic.getFromKeyFieldsOr404(kwargs)
   292     program_entity = logic.getFromKeyFieldsOr404(kwargs)
   293 
   293 
   294     filter = {
   294     filter = {
   295 	'status': 'accepted',
   295         'status': 'accepted',
   296 	'program': program_entity }
   296         'program': program_entity}
   297 
   297 
   298     fmt = {'name': program_entity.name}
   298     fmt = {'name': program_entity.name}
   299     description = self.DEF_ACCEPTED_PROJECTS_MSG_FMT % fmt
   299     description = self.DEF_ACCEPTED_PROJECTS_MSG_FMT % fmt
   300 
   300 
   301     from soc.views.models import student_project as sp_view
   301     from soc.views.models import student_project as sp_view
   302 
   302 
   303     ap_params = sp_view.view.getParams().copy() # accepted projects
   303     ap_params = sp_view.view.getParams().copy() # accepted projects
   304 
   304     ap_params['list_action'] = (redirects.getPublicRedirect, ap_params)
   305     fun =  soc.cache.logic.cache(self._getData)
   305     ap_params['list_description'] = description
   306     ap_logic = ap_params['logic']
   306     ap_params['list_heading'] = 'soc/student_project/list/heading_all.html'
   307     entities = fun(logic.getModel(), filter, order=None, logic=ap_logic)
   307     ap_params['list_row'] = 'soc/student_project/list/row_all.html'
   308     
   308 
   309     ap_list = dicts.rename(ap_params, ap_params['list_params'])
   309     return self.list(request, access_type, page_name=page_name,
   310     ap_list['action'] = (redirects.getPublicRedirect, ap_params)
   310                      params=ap_params, filter=filter)
   311     ap_list['description'] = description
       
   312     ap_list['pagination'] = 'soc/list/no_pagination.html'
       
   313     ap_list['heading'] = 'soc/student_project/list/heading_all.html'
       
   314     ap_list['row'] = 'soc/student_project/list/row_all.html'
       
   315     ap_list['data'] = entities
       
   316 
       
   317     contents.append(ap_list)
       
   318 
       
   319     params = params.copy()
       
   320 
       
   321     return self._list(request, params, contents, page_name)
       
   322 
   311 
   323   @decorators.merge_params
   312   @decorators.merge_params
   324   @decorators.check_access
   313   @decorators.check_access
   325   def slots(self, request, acces_type, page_name=None, params=None, **kwargs):
   314   def slots(self, request, acces_type, page_name=None, params=None, **kwargs):
   326     """Returns a JSON object with all orgs allocation.
   315     """Returns a JSON object with all orgs allocation.