def _check_postponement_proposal_state(self, luy, ac_year): if is_learning_unit_year_in_proposal(luy): self.consistency_errors.setdefault(ac_year, []).append( _("learning_unit_in_proposal_cannot_save") % { 'luy': luy.acronym, 'academic_year': ac_year })
def get_full_context(learning_unit_year): context = {'learning_unit_year': learning_unit_year} initial_data = None components_list = {} if proposal_learning_unit.is_learning_unit_year_in_proposal( learning_unit_year): initial_data = reinitialize_learning_unit_year(components_list, context, initial_data, learning_unit_year) context['learning_unit_year_fields'] = get_learning_unit_context( learning_unit_year) context[ 'learning_container_year_fields'] = get_learning_container_year_context( learning_unit_year) context['campus'] = learning_unit_year.campus.name context['learning_container_year_partims'] = [ partim.subdivision for partim in learning_unit_year.get_partims_related() ] context['entities_fields'] = get_entities_context(initial_data, learning_unit_year) if 'components' not in context: components = get_components_identification(learning_unit_year) get_component_values(components, components_list) context['components'] = components_list return context
def _check_postponement_learning_unit_year_proposal_state(nex_luy): error_msg = _("The learning unit %(luy)s is in proposal," " can not save the change from the year %(academic_year)s") % { 'luy': nex_luy.acronym, 'academic_year': nex_luy.academic_year } return [error_msg] if is_learning_unit_year_in_proposal(nex_luy) else []
def _check_postponement_learning_unit_year_proposal_state(nex_luy): error_msg = _( "The learning unit %(luy)s is in proposal," " can not save the change from the year %(academic_year)s") % { 'luy': nex_luy.acronym, 'academic_year': nex_luy.academic_year } return [error_msg] if is_learning_unit_year_in_proposal(nex_luy) else []
def get(self, request, *args, **kwargs): # Get does not need to fetch self.object again context = self.get_context_data(object=self.object) if proposal_learning_unit.is_learning_unit_year_in_proposal(self.object) and \ self.object.get_partims_related().exists(): display_warning_messages(request, _("The learning unit have partim")) return self.render_to_response(context)
def _check_postponement_proposal_state(self, luy, ac_year): if is_learning_unit_year_in_proposal(luy): self.consistency_errors.setdefault(ac_year, []).append( _("The learning unit %(luy)s is in proposal, can not" " save the change from the year %(academic_year)s") % { 'luy': luy.acronym, 'academic_year': ac_year } )
def get(self, request, *args, **kwargs): if SEARCH_URL_PART in self.request.META.get('HTTP_REFERER', ''): add_to_session(request, 'search_url', self.request.META.get('HTTP_REFERER')) # Get does not need to fetch self.object again context = self.get_context_data(object=self.object) if proposal_learning_unit.is_learning_unit_year_in_proposal(self.object) and \ self.object.get_partims_related().exists(): display_warning_messages(request, _("The learning unit have partim")) return self.render_to_response(context)
def get_full_context(learning_unit_year): context = {'learning_unit_year': learning_unit_year} initial_data = None components_list = {} if proposal_learning_unit.is_learning_unit_year_in_proposal( learning_unit_year): initial_data = reinitialize_learning_unit_year(components_list, context, initial_data, learning_unit_year) context['learning_unit_year_fields'] = get_learning_unit_context( learning_unit_year) context[ 'learning_container_year_fields'] = get_learning_container_year_context( learning_unit_year) context['campus'] = learning_unit_year.campus.name context['learning_container_year_partims'] = [ partim.subdivision for partim in learning_unit_year.get_partims_related() ] context['entities_fields'] = get_entities_context(initial_data, learning_unit_year) if 'components' not in context: components = get_components_identification(learning_unit_year) for component in components['components']: volumes = { _('Volume total annual'): component['volumes']['VOLUME_TOTAL'] or 0, _('Planned classes'): component['volumes']['PLANNED_CLASSES'] or 0, _('Volume Q1'): component['volumes']['VOLUME_Q1'] or 0, _('Volume Q2'): component['volumes']['VOLUME_Q2'] or 0 } components_list[_get_value_from_enum( LEARNING_COMPONENT_YEAR_TYPES, component['learning_component_year'].type)] = volumes context['components'] = components_list return context
def _check_postponement_learning_unit_year_proposal_state(nex_luy): error_msg = _("learning_unit_in_proposal_cannot_save") % { 'luy': nex_luy.acronym, 'academic_year': nex_luy.academic_year } return [error_msg] if is_learning_unit_year_in_proposal(nex_luy) else []