app/soc/views/models/student_project.py
changeset 2856 f446e019825c
parent 2746 ca3b1a86bce8
child 2970 605e3c3a55e9
equal deleted inserted replaced
2855:ec2ed1571e3a 2856:f446e019825c
   688     # get the context for this webpage
   688     # get the context for this webpage
   689     context = responses.getUniversalContext(request)
   689     context = responses.getUniversalContext(request)
   690     responses.useJavaScript(context, params['js_uses_all'])
   690     responses.useJavaScript(context, params['js_uses_all'])
   691     context['page_name'] = '%s %s' % (page_name, org_entity.name)
   691     context['page_name'] = '%s %s' % (page_name, org_entity.name)
   692 
   692 
       
   693     prefetch = ['student', 'mentor']
       
   694 
   693     list_params = params.copy()
   695     list_params = params.copy()
   694     list_params['list_heading'] = params['manage_overview_heading']
   696     list_params['list_heading'] = params['manage_overview_heading']
   695     list_params['list_row'] = params['manage_overview_row']
   697     list_params['list_row'] = params['manage_overview_row']
   696 
   698 
   697     #list all active projects
   699     #list all active projects
   699     active_params = list_params.copy()
   701     active_params = list_params.copy()
   700     active_params['list_description'] = \
   702     active_params['list_description'] = \
   701         'List of all active %(name_plural)s' % list_params
   703         'List of all active %(name_plural)s' % list_params
   702     active_params['list_action'] = (redirects.getManageRedirect, list_params)
   704     active_params['list_action'] = (redirects.getManageRedirect, list_params)
   703 
   705 
   704     active_list = lists.getListContent(
   706     active_list = lists.getListContent(request, active_params, fields, idx=0,
   705         request, active_params, fields, idx=0)
   707                                        prefetch=prefetch)
   706     # set the needed info
   708     # set the needed info
   707     active_list = list_info.setStudentProjectSurveyInfo(active_list,
   709     active_list = list_info.setStudentProjectSurveyInfo(active_list,
   708                                                         org_entity.scope)
   710                                                         org_entity.scope)
   709 
   711 
   710     # list all failed projects
   712     # list all failed projects
   712     failed_params = list_params.copy()
   714     failed_params = list_params.copy()
   713     failed_params['list_description'] = ('List of all %(name_plural)s who ' 
   715     failed_params['list_description'] = ('List of all %(name_plural)s who ' 
   714                                          'failed the program.') % list_params
   716                                          'failed the program.') % list_params
   715     failed_params['list_action'] = (redirects.getManageRedirect, list_params)
   717     failed_params['list_action'] = (redirects.getManageRedirect, list_params)
   716 
   718 
   717     failed_list = lists.getListContent(
   719     failed_list = lists.getListContent(request, failed_params, fields, idx=1,
   718         request, failed_params, fields, idx=1, need_content=True)
   720                                        need_content=True, prefetch=prefetch)
   719     # set the needed info
   721     # set the needed info
   720     failed_list = list_info.setStudentProjectSurveyInfo(failed_list,
   722     failed_list = list_info.setStudentProjectSurveyInfo(failed_list,
   721                                                         org_entity.scope)
   723                                                         org_entity.scope)
   722 
   724 
   723     # list all completed projects
   725     # list all completed projects
   726     completed_params['list_description'] = (
   728     completed_params['list_description'] = (
   727         'List of %(name_plural)s that have successfully completed the '
   729         'List of %(name_plural)s that have successfully completed the '
   728         'program.' % list_params)
   730         'program.' % list_params)
   729     completed_params['list_action'] = (redirects.getManageRedirect, list_params)
   731     completed_params['list_action'] = (redirects.getManageRedirect, list_params)
   730 
   732 
   731     completed_list = lists.getListContent(
   733     completed_list = lists.getListContent(request, completed_params, fields,
   732         request, completed_params, fields, idx=2, need_content=True)
   734                                           idx=2, need_content=True,
       
   735                                           prefetch=prefetch)
   733     # set the needed info
   736     # set the needed info
   734     completed_list = list_info.setStudentProjectSurveyInfo(completed_list,
   737     completed_list = list_info.setStudentProjectSurveyInfo(completed_list,
   735                                                            org_entity.scope)
   738                                                            org_entity.scope)
   736 
   739 
   737     # list all withdrawn projects
   740     # list all withdrawn projects
   740     withdrawn_params['list_description'] = (
   743     withdrawn_params['list_description'] = (
   741         'List of %(name_plural)s that have withdrawn from the program.' %(
   744         'List of %(name_plural)s that have withdrawn from the program.' %(
   742             list_params))
   745             list_params))
   743     withdrawn_params['list_action'] = (redirects.getManageRedirect, list_params)
   746     withdrawn_params['list_action'] = (redirects.getManageRedirect, list_params)
   744 
   747 
   745     withdrawn_list = lists.getListContent(
   748     withdrawn_list = lists.getListContent(request, withdrawn_params, fields,
   746         request, withdrawn_params, fields, idx=3, need_content=True)
   749                                           idx=3, need_content=True,
       
   750                                           prefetch=prefetch)
   747     # set the needed info
   751     # set the needed info
   748     withdrawn_list = list_info.setStudentProjectSurveyInfo(withdrawn_list,
   752     withdrawn_list = list_info.setStudentProjectSurveyInfo(withdrawn_list,
   749                                                            org_entity.scope)
   753                                                            org_entity.scope)
   750 
   754 
   751     # always show the list with active projects
   755     # always show the list with active projects