def context(self, data, check, mutator): """Returns the context for this page.""" program = data.program conversion_status = conversion_logic.getOrCreateStatusForProgram(program) context = { 'page_name': 'Accept proposals for %s' % program.name, 'conversion_status': conversion_status, } return context
def context(self, data, check, mutator): """Returns the context for this page.""" program = data.program conversion_status = conversion_logic.getOrCreateStatusForProgram( program) context = { 'page_name': 'Accept proposals for %s' % program.name, 'conversion_status': conversion_status, } return context
def status(self, request, *args, **kwargs): """Update the status of proposals conversion. Expects the following to be present in the POST dict: program_key: Specifies the program key name for which to update the conversion status Args: request: Django Request object """ params = request.POST # retrieve the program_key from POST data program_key = params.get('program_key') if not program_key: # invalid task data, log and return OK return error_handler.logErrorAndReturnOK( '"Missing program_key in params: "%s"' % params) # get the program for the given keyname program_entity = GSoCProgram.get_by_key_name(program_key) if not program_entity: # invalid program specified, log and return OK return error_handler.logErrorAndReturnOK( 'Invalid program key specified: "%s"' % program_key) # obtain the accept proposals status aps_entity = conversion_logic.getOrCreateStatusForProgram(program_entity) # update the accept proposals status aps_entity.status = 'proceeded' # if the first proposal set the started_on converted_projects = aps_entity.nr_converted_projects + 1 if converted_projects == 1: aps_entity.started_on = datetime.datetime.now() # tracks the number of converted projects so far aps_entity.nr_converted_projects = converted_projects db.put(aps_entity) # return OK return http.HttpResponse()