app/soc/views/models/student_project.py
changeset 2711 4df8c11c36cb
parent 2707 ffabb3576744
child 2715 afd5368af75c
equal deleted inserted replaced
2710:9a93624bd2d4 2711:4df8c11c36cb
    81     rights['st_edit'] = ['checkIsMyStudentProject',
    81     rights['st_edit'] = ['checkIsMyStudentProject',
    82         ('checkStudentProjectHasStatus',
    82         ('checkStudentProjectHasStatus',
    83             [['accepted', 'completed']])
    83             [['accepted', 'completed']])
    84         ]
    84         ]
    85     rights['withdraw'] = ['checkIsHostForProgram']
    85     rights['withdraw'] = ['checkIsHostForProgram']
    86     rights['withdraw_project'] = ['checkIsHost'] # TODO proper check
    86     rights['withdraw_project'] = ['checkIsHostForStudentProject',
    87     rights['accept_project'] = ['checkIsHost'] # TODO proper check
    87         ('checkStudentProjectHasStatus',
       
    88             [['accepted', 'completed']])
       
    89         ]
       
    90     rights['accept_project'] = ['checkIsHostForStudentProject',
       
    91         ('checkStudentProjectHasStatus',
       
    92             [['withdrawn']])
       
    93         ]
    88 
    94 
    89     new_params = {}
    95     new_params = {}
    90     new_params['logic'] = soc.logic.models.student_project.logic
    96     new_params['logic'] = soc.logic.models.student_project.logic
    91     new_params['rights'] = rights
    97     new_params['rights'] = rights
    92     new_params['name'] = "Student Project"
    98     new_params['name'] = "Student Project"
   241 
   247 
   242   @decorators.merge_params
   248   @decorators.merge_params
   243   @decorators.check_access
   249   @decorators.check_access
   244   def withdraw(self, request, access_type,
   250   def withdraw(self, request, access_type,
   245                       page_name=None, params=None, **kwargs):
   251                       page_name=None, params=None, **kwargs):
   246     """View that allows Program Admins to accept or withdraw Students.
   252     """View that allows Program Admins to accept or withdraw Student Projects.
   247 
   253 
   248     For params see base.View().public()
   254     For params see base.View().public()
   249     """
   255     """
   250 
   256 
   251     program = program_logic.getFromKeyFieldsOr404(kwargs)
   257     program = program_logic.getFromKeyFieldsOr404(kwargs)
   262         "An overview of accepted and completed Projects.")
   268         "An overview of accepted and completed Projects.")
   263 
   269 
   264     ap_list = lists.getListContent(
   270     ap_list = lists.getListContent(
   265         request, ap_params, fields, idx=0)
   271         request, ap_params, fields, idx=0)
   266 
   272 
   267     fields['status'] = ['withdrawn', 'invalid', 'failed']
   273     fields['status'] = ['withdrawn']
   268 
   274 
   269     wp_params = params.copy() # withdrawn projects
   275     wp_params = params.copy() # withdrawn projects
   270 
   276 
   271     wp_params['list_action'] = (redirects.getAcceptProjectRedirect, wp_params)
   277     wp_params['list_action'] = (redirects.getAcceptProjectRedirect, wp_params)
   272     wp_params['list_description'] = ugettext(
   278     wp_params['list_description'] = ugettext(
   273         "An overview of withdrawn, invalid, and failed Projects.")
   279         "An overview of withdrawn Projects.")
   274 
   280 
   275     wp_list = lists.getListContent(
   281     wp_list = lists.getListContent(
   276         request, wp_params, fields, idx=1)
   282         request, wp_params, fields, idx=1)
   277 
   283 
   278     # fill contents with all the needed lists
   284     # fill contents with all the needed lists
   283 
   289 
   284   @decorators.merge_params
   290   @decorators.merge_params
   285   @decorators.check_access
   291   @decorators.check_access
   286   def withdrawProject(self, request, access_type,
   292   def withdrawProject(self, request, access_type,
   287                       page_name=None, params=None, **kwargs):
   293                       page_name=None, params=None, **kwargs):
   288     """View that allows Program Admins to withdraw Students.
   294     """View that allows Program Admins to withdraw Student Projects.
   289 
   295 
   290     For params see base.View().public()
   296     For params see base.View().public()
   291 
   297 
   292     """
   298     """
   293 
   299 
   306 
   312 
   307   @decorators.merge_params
   313   @decorators.merge_params
   308   @decorators.check_access
   314   @decorators.check_access
   309   def acceptProject(self, request, access_type,
   315   def acceptProject(self, request, access_type,
   310                       page_name=None, params=None, **kwargs):
   316                       page_name=None, params=None, **kwargs):
   311     """View that allows Program Admins to accept Students.
   317     """View that allows Program Admins to accept Student Projects.
   312 
   318 
   313     For params see base.View().public()
   319     For params see base.View().public()
   314 
   320 
   315     """
   321     """
   316 
   322