app/soc/views/models/student_project.py
changeset 2573 f09f317769c4
parent 2360 e389d26949db
child 2637 0ae090b18a5e
equal deleted inserted replaced
2572:1ad6d986be6d 2573:f09f317769c4
    70     rights['delete'] = ['checkIsDeveloper']
    70     rights['delete'] = ['checkIsDeveloper']
    71     rights['show'] = ['allow']
    71     rights['show'] = ['allow']
    72     rights['list'] = ['checkIsDeveloper']
    72     rights['list'] = ['checkIsDeveloper']
    73     rights['manage'] = [('checkHasActiveRoleForScope',
    73     rights['manage'] = [('checkHasActiveRoleForScope',
    74                          org_admin_logic),
    74                          org_admin_logic),
    75         ('checkStudentProjectHasStatus', [['accepted', 'mid_term_passed']])]
    75         ('checkStudentProjectHasStatus', [['accepted']])]
    76     rights['manage_overview'] = [('checkHasActiveRoleForScope',
    76     rights['manage_overview'] = [('checkHasActiveRoleForScope',
    77                          org_admin_logic)]
    77                          org_admin_logic)]
    78     # TODO: lack of better name here!
    78     # TODO: lack of better name here!
    79     rights['st_edit'] = ['checkIsMyStudentProject',
    79     rights['st_edit'] = ['checkIsMyStudentProject',
    80         ('checkStudentProjectHasStatus',
    80         ('checkStudentProjectHasStatus',
    81             [['accepted', 'mid_term_passed', 'passed']])
    81             [['accepted', 'completed']])
    82         ]
    82         ]
    83 
    83 
    84     new_params = {}
    84     new_params = {}
    85     new_params['logic'] = soc.logic.models.student_project.logic
    85     new_params['logic'] = soc.logic.models.student_project.logic
    86     new_params['rights'] = rights
    86     new_params['rights'] = rights
    93 
    93 
    94     new_params['no_create_with_key_fields'] = True
    94     new_params['no_create_with_key_fields'] = True
    95 
    95 
    96     new_params['extra_dynaexclude'] = ['program', 'status', 'link_id',
    96     new_params['extra_dynaexclude'] = ['program', 'status', 'link_id',
    97                                        'mentor', 'additional_mentors',
    97                                        'mentor', 'additional_mentors',
    98                                        'student']
    98                                        'student', 'passed_evaluations']
    99 
    99 
   100     new_params['create_extra_dynaproperties'] = {
   100     new_params['create_extra_dynaproperties'] = {
   101         'scope_path': forms.CharField(widget=forms.HiddenInput,
   101         'scope_path': forms.CharField(widget=forms.HiddenInput,
   102             required=True),
   102             required=True),
   103         'public_info': forms.fields.CharField(required=True,
   103         'public_info': forms.fields.CharField(required=True,
   488     context['page_name'] = '%s %s' % (page_name, org_entity.name)
   488     context['page_name'] = '%s %s' % (page_name, org_entity.name)
   489 
   489 
   490     list_params = params.copy()
   490     list_params = params.copy()
   491 
   491 
   492     #list all active projects
   492     #list all active projects
   493     fields['status'] = ['accepted', 'mid_term_passed']
   493     fields['status'] = 'accepted'
   494     active_params = list_params.copy()
   494     active_params = list_params.copy()
   495     active_params['list_description'] = \
   495     active_params['list_description'] = \
   496         'List of all active %(name_plural)s' % list_params
   496         'List of all active %(name_plural)s' % list_params
   497     active_params['list_action'] = (redirects.getManageRedirect, list_params)
   497     active_params['list_action'] = (redirects.getManageRedirect, list_params)
   498 
   498 
   499     active_list = lists.getListContent(
   499     active_list = lists.getListContent(
   500         request, active_params, fields, idx=0)
   500         request, active_params, fields, idx=0)
   501 
   501 
   502     # list all failed projects
   502     # list all failed projects
   503     fields['status'] = ['mid_term_failed', 'final_failed']
   503     fields['status'] = 'failed'
   504     failed_params = list_params.copy()
   504     failed_params = list_params.copy()
   505     failed_params['list_description'] = ('List of all failed %(name_plural)s, '
   505     failed_params['list_description'] = ('List of all failed %(name_plural)s, '
   506         'these cannot be managed.') % list_params
   506         'these cannot be managed.') % list_params
   507     failed_params['list_action'] = (redirects.getPublicRedirect, list_params)
   507     failed_params['list_action'] = (redirects.getPublicRedirect, list_params)
   508 
   508 
   509     failed_list = lists.getListContent(
   509     failed_list = lists.getListContent(
   510         request, failed_params, fields, idx=1, need_content=True)
   510         request, failed_params, fields, idx=1, need_content=True)
   511 
   511 
   512     #list all completed projects
   512     #list all completed projects
   513     fields['status'] = ['passed']
   513     fields['status'] = 'completed'
   514     completed_params = list_params.copy()
   514     completed_params = list_params.copy()
   515     completed_params['list_description'] = ('List of %(name_plural)s that have '
   515     completed_params['list_description'] = ('List of %(name_plural)s that have '
   516         'successfully completed the program, '
   516         'successfully completed the program, '
   517         'these cannot be managed.' % list_params)
   517         'these cannot be managed.' % list_params)
   518     completed_params['list_action'] = (redirects.getPublicRedirect, list_params)
   518     completed_params['list_action'] = (redirects.getPublicRedirect, list_params)