Exemplo n.º 1
0
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, get_object_or_404(Person, user=request.user))
    label_name = request.GET.get('label')
    text_lb = text_label.get_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'] = get_text_label_translated(
        text_lb, user_language)
    context['language_translated'] = find_language_in_settings(language)
    return render(request, "learning_unit/specifications_edit.html", context)
Exemplo n.º 2
0
def edit_learning_unit_pedagogy(request, learning_unit_year_id, redirect_url):
    if request.method == 'POST':
        form = LearningUnitPedagogyEditForm(request.POST)
        if form.is_valid():
            form.save()
        return redirect(redirect_url)

    context = get_common_context_learning_unit_year(
        learning_unit_year_id,
        get_object_or_404(Person, user=request.user)
    )
    label_name = request.GET.get('label')
    language = request.GET.get('language')
    text_lb = text_label.get_by_name(label_name)
    form = LearningUnitPedagogyEditForm(**{
        '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'] = get_text_label_translated(text_lb, user_language)
    context['language_translated'] = find_language_in_settings(language)
    context['cms_label_pedagogy_fr_only'] = CMS_LABEL_PEDAGOGY_FR_ONLY
    context['label_name'] = label_name
    return render(request, "learning_unit/pedagogy_edit.html", context)
Exemplo n.º 3
0
 def cms_text_label(self):
     return text_label.get_by_name(CMS_LABEL_ADDITIONAL_INFORMATION)
Exemplo n.º 4
0
 def cms_text_label(self):
     return text_label.get_by_name(CMS_LABEL_PROGRAM_AIM)