app/soc/views/models/student_project.py
changeset 2746 ca3b1a86bce8
parent 2743 b9a146acb9bb
child 2856 f446e019825c
equal deleted inserted replaced
2745:c45dc8a5d64e 2746:ca3b1a86bce8
   708                                                         org_entity.scope)
   708                                                         org_entity.scope)
   709 
   709 
   710     # list all failed projects
   710     # list all failed projects
   711     fields['status'] = 'failed'
   711     fields['status'] = 'failed'
   712     failed_params = list_params.copy()
   712     failed_params = list_params.copy()
   713     failed_params['list_description'] = ('List of all failed %(name_plural)s, '
   713     failed_params['list_description'] = ('List of all %(name_plural)s who ' 
   714         'these cannot be managed.') % list_params
   714                                          'failed the program.') % list_params
   715     failed_params['list_action'] = (redirects.getPublicRedirect, list_params)
   715     failed_params['list_action'] = (redirects.getManageRedirect, list_params)
   716 
   716 
   717     failed_list = lists.getListContent(
   717     failed_list = lists.getListContent(
   718         request, failed_params, fields, idx=1, need_content=True)
   718         request, failed_params, fields, idx=1, need_content=True)
   719     # set the needed info
   719     # set the needed info
   720     failed_list = list_info.setStudentProjectSurveyInfo(failed_list,
   720     failed_list = list_info.setStudentProjectSurveyInfo(failed_list,
   721                                                         org_entity.scope)
   721                                                         org_entity.scope)
   722 
   722 
   723     # list all completed projects
   723     # list all completed projects
   724     fields['status'] = 'completed'
   724     fields['status'] = 'completed'
   725     completed_params = list_params.copy()
   725     completed_params = list_params.copy()
   726     completed_params['list_description'] = ('List of %(name_plural)s that have '
   726     completed_params['list_description'] = (
   727         'successfully completed the program, '
   727         'List of %(name_plural)s that have successfully completed the '
   728         'these cannot be managed.' % list_params)
   728         'program.' % list_params)
   729     completed_params['list_action'] = (redirects.getPublicRedirect, list_params)
   729     completed_params['list_action'] = (redirects.getManageRedirect, list_params)
   730 
   730 
   731     completed_list = lists.getListContent(
   731     completed_list = lists.getListContent(
   732         request, completed_params, fields, idx=2, need_content=True)
   732         request, completed_params, fields, idx=2, need_content=True)
   733     # set the needed info
   733     # set the needed info
   734     completed_list = list_info.setStudentProjectSurveyInfo(completed_list,
   734     completed_list = list_info.setStudentProjectSurveyInfo(completed_list,
   735                                                            org_entity.scope)
   735                                                            org_entity.scope)
   736 
   736 
       
   737     # list all withdrawn projects
       
   738     fields['status'] = 'withdrawn'
       
   739     withdrawn_params = list_params.copy()
       
   740     withdrawn_params['list_description'] = (
       
   741         'List of %(name_plural)s that have withdrawn from the program.' %(
       
   742             list_params))
       
   743     withdrawn_params['list_action'] = (redirects.getManageRedirect, list_params)
       
   744 
       
   745     withdrawn_list = lists.getListContent(
       
   746         request, withdrawn_params, fields, idx=3, need_content=True)
       
   747     # set the needed info
       
   748     withdrawn_list = list_info.setStudentProjectSurveyInfo(withdrawn_list,
       
   749                                                            org_entity.scope)
       
   750 
   737     # always show the list with active projects
   751     # always show the list with active projects
   738     content = [active_list]
   752     content = [active_list]
   739 
   753 
   740     if failed_list != None:
   754     if failed_list != None:
   741       # do not show empty failed list
   755       # do not show empty failed list
   742       content.append(failed_list)
   756       content.append(failed_list)
   743 
   757 
   744     if completed_list != None:
   758     if completed_list != None:
   745       # do not show empty completed list
   759       # do not show empty completed list
   746       content.append(completed_list)
   760       content.append(completed_list)
       
   761 
       
   762     if withdrawn_list != None:
       
   763       # do not show empty withdrawn list
       
   764       content.append(withdrawn_list)
   747 
   765 
   748     # call the _list method from base to display the list
   766     # call the _list method from base to display the list
   749     return self._list(request, list_params, content,
   767     return self._list(request, list_params, content,
   750                       context['page_name'], context)
   768                       context['page_name'], context)
   751 
   769