def learning_class_year_edit(request, learning_unit_year_id): context = get_common_context_learning_unit_year(learning_unit_year_id) context.update({ 'learning_class_year': mdl.learning_class_year.find_by_id( request.GET.get('learning_class_year_id')), 'learning_component_year': mdl.learning_component_year.find_by_id( request.GET.get('learning_component_year_id')) }) if request.method == 'POST': form = LearningClassEditForm( request.POST, instance=context['learning_class_year'], learning_unit_year=context['learning_unit_year'], learning_component_year=context['learning_component_year']) if form.is_valid(): form.save() return HttpResponseRedirect( reverse("learning_unit_components", kwargs={'learning_unit_year_id': learning_unit_year_id})) form = LearningClassEditForm( instance=context['learning_class_year'], learning_unit_year=context['learning_unit_year'], learning_component_year=context['learning_component_year']) form.load_initial() # Load data from database context['form'] = form return layout.render(request, "learning_unit/class_edit.html", context)
def learning_unit_identification(request, learning_unit_year_id): person = get_object_or_404(Person, user=request.user) context = get_common_context_learning_unit_year(learning_unit_year_id) learning_unit_year = context['learning_unit_year'] context[ 'learning_container_year_partims'] = learning_unit_year.get_partims_related( ) context['organization'] = get_organization_from_learning_unit_year( learning_unit_year) context['campus'] = get_campus_from_learning_unit_year(learning_unit_year) context['experimental_phase'] = True context['show_subtype'] = show_subtype(learning_unit_year) context.update(get_all_attributions(learning_unit_year)) context['components'] = get_components_identification(learning_unit_year) context[ 'can_propose'] = learning_unit_proposal.is_eligible_for_modification_proposal( learning_unit_year, person) context['proposal'] = proposal_learning_unit.find_by_learning_unit_year( learning_unit_year) context['proposal_folder_entity_version'] = \ entity_version.get_by_entity_and_date(context['proposal'].folder.entity, None) if context['proposal'] else None context[ 'can_delete'] = learning_unit_deletion.can_delete_learning_unit_year( person, learning_unit_year) return layout.render(request, "learning_unit/identification.html", context)
def learning_unit_components(request, learning_unit_year_id): context = get_common_context_learning_unit_year(learning_unit_year_id) context['components'] = get_same_container_year_components( context['learning_unit_year'], True) context['tab_active'] = 'components' context['experimental_phase'] = True return layout.render(request, "learning_unit/components.html", context)
def learning_unit_specifications_edit(request, learning_unit_year_id): if request.method == 'POST': form = LearningUnitSpecificationsEditForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect( reverse("learning_unit_specifications", kwargs={'learning_unit_year_id': learning_unit_year_id})) context = get_common_context_learning_unit_year(learning_unit_year_id) label_name = request.GET.get('label') text_lb = text_label.find_root_by_name(label_name) language = request.GET.get('language') form = LearningUnitSpecificationsEditForm( **{ 'learning_unit_year': context['learning_unit_year'], 'language': language, 'text_label': text_lb }) form.load_initial() # Load data from database context['form'] = form user_language = mdl.person.get_user_interface_language(request.user) context['text_label_translated'] = next( (txt for txt in text_lb.translated_text_labels if txt.language == user_language), None) context['language_translated'] = next( (lang for lang in settings.LANGUAGES if lang[0] == language), None) return layout.render(request, "learning_unit/specifications_edit.html", context)
def learning_unit_volumes_management(request, learning_unit_year_id): if request.method == 'POST': _learning_unit_volumes_management_edit(request, learning_unit_year_id) context = get_common_context_learning_unit_year(learning_unit_year_id) context[ 'learning_units'] = learning_unit_year_with_context.get_with_context( learning_container_year_id=context['learning_unit_year']. learning_container_year_id) context['tab_active'] = 'components' context['experimental_phase'] = True return layout.render(request, "learning_unit/volumes_management.html", context)
def learning_unit_specifications(request, learning_unit_year_id): context = get_common_context_learning_unit_year(learning_unit_year_id) learning_unit_year = context['learning_unit_year'] user_language = mdl.person.get_user_interface_language(request.user) context['cms_labels_translated'] = get_cms_label_data( CMS_LABEL_SPECIFICATIONS, user_language) fr_language = next( (lang for lang in settings.LANGUAGES if lang[0] == 'fr-be'), None) en_language = next( (lang for lang in settings.LANGUAGES if lang[0] == 'en'), None) context.update({ 'form_french': LearningUnitSpecificationsForm(learning_unit_year, fr_language), 'form_english': LearningUnitSpecificationsForm(learning_unit_year, en_language) }) context['experimental_phase'] = True return layout.render(request, "learning_unit/specifications.html", context)
def learning_unit_pedagogy(request, learning_unit_year_id): context = get_common_context_learning_unit_year(learning_unit_year_id) learning_unit_year = context['learning_unit_year'] user_language = mdl.person.get_user_interface_language(request.user) context['cms_labels_translated'] = get_cms_label_data( CMS_LABEL_PEDAGOGY, user_language) fr_language = next( (lang for lang in settings.LANGUAGES if lang[0] == 'fr-be'), None) en_language = next( (lang for lang in settings.LANGUAGES if lang[0] == 'en'), None) context.update({ 'form_french': LearningUnitPedagogyForm(learning_unit_year=learning_unit_year, language=fr_language), 'form_english': LearningUnitPedagogyForm(learning_unit_year=learning_unit_year, language=en_language) }) context['experimental_phase'] = True return layout.render(request, "learning_unit/pedagogy.html", context)
def learning_unit_attributions(request, learning_unit_year_id): context = get_common_context_learning_unit_year(learning_unit_year_id) context['attributions'] = mdl_attr.attribution.find_by_learning_unit_year( learning_unit_year=learning_unit_year_id) context['experimental_phase'] = True return layout.render(request, "learning_unit/attributions.html", context)
def learning_unit_formations(request, learning_unit_year_id): context = get_common_context_learning_unit_year(learning_unit_year_id) return layout.render(request, "learning_unit/formations.html", context)