コード例 #1
0
def read_learning_unit_pedagogy(request, learning_unit_year_id, context,
                                template):
    person = get_object_or_404(Person, user=request.user)
    context.update(
        get_common_context_learning_unit_year(learning_unit_year_id, person))
    learning_unit_year = context['learning_unit_year']
    perm_to_edit = is_eligible_to_update_learning_unit_pedagogy(
        learning_unit_year, person)
    user_language = mdl.person.get_user_interface_language(request.user)
    context['cms_labels_translated'] = get_cms_label_data(
        CMS_LABEL_PEDAGOGY, user_language)
    context['form_french'] = LearningUnitPedagogyForm(
        learning_unit_year=learning_unit_year,
        language_code=settings.LANGUAGE_CODE_FR)
    context['form_english'] = LearningUnitPedagogyForm(
        learning_unit_year=learning_unit_year,
        language_code=settings.LANGUAGE_CODE_EN)
    context[
        'teaching_materials'] = teaching_material.find_by_learning_unit_year(
            learning_unit_year)
    context['can_edit_information'] = perm_to_edit
    context[
        'can_edit_summary_locked_field'] = perms.can_edit_summary_locked_field(
            learning_unit_year, person)
    context[
        'summary_responsibles'] = find_all_summary_responsibles_by_learning_unit_year(
            learning_unit_year)
    context['other_teachers'] = get_no_summary_responsible_teachers(
        learning_unit_year, context['summary_responsibles'])
    context['cms_label_pedagogy_fr_only'] = CMS_LABEL_PEDAGOGY_FR_ONLY
    return render(request, template, context)
コード例 #2
0
def learning_unit_specifications(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,
                                                    person)
    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 = find_language_in_settings(settings.LANGUAGE_CODE_FR)
    en_language = find_language_in_settings(settings.LANGUAGE_CODE_EN)

    context.update({
        'form_french':
        LearningUnitSpecificationsForm(learning_unit_year, fr_language),
        'form_english':
        LearningUnitSpecificationsForm(learning_unit_year, en_language)
    })

    context.update(get_achievements_group_by_language(learning_unit_year))
    context.update({
        'LANGUAGE_CODE_FR': settings.LANGUAGE_CODE_FR,
        'LANGUAGE_CODE_EN': settings.LANGUAGE_CODE_EN
    })
    context[
        'can_update_learning_achievement'] = can_update_learning_achievement(
            learning_unit_year, person)
    context['experimental_phase'] = True
    return layout.render(request, "learning_unit/specifications.html", context)
コード例 #3
0
def get_specifications_context(learning_unit_year, request):
    user_language = mdl.person.get_user_interface_language(request.user)
    fr_language = find_language_in_settings(settings.LANGUAGE_CODE_FR)
    en_language = find_language_in_settings(settings.LANGUAGE_CODE_EN)
    return {
        'cms_specification_labels_translated': get_cms_label_data(CMS_LABEL_SPECIFICATIONS, user_language),
        'form_french': LearningUnitSpecificationsForm(learning_unit_year, fr_language),
        'form_english': LearningUnitSpecificationsForm(learning_unit_year, en_language)
    }
コード例 #4
0
ファイル: update.py プロジェクト: makinacorpus/osis
def get_cms_pedagogy_form(request, learning_unit_year):
    user_language = mdl.person.get_user_interface_language(request.user)
    return {
        'cms_labels_translated':
        get_cms_label_data(CMS_LABEL_PEDAGOGY, user_language),
        'form_french':
        LearningUnitPedagogyForm(learning_unit_year=learning_unit_year,
                                 language_code=settings.LANGUAGE_CODE_FR),
        'form_english':
        LearningUnitPedagogyForm(learning_unit_year=learning_unit_year,
                                 language_code=settings.LANGUAGE_CODE_EN)
    }
コード例 #5
0
def learning_unit_pedagogy(request, learning_unit_year_id):
    context = get_common_context_learning_unit_year(
        learning_unit_year_id, get_object_or_404(Person, user=request.user))
    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)

    context['form_french'] = initialize_learning_unit_pedagogy_form(
        learning_unit_year, settings.LANGUAGE_CODE_FR)
    context['form_english'] = initialize_learning_unit_pedagogy_form(
        learning_unit_year, settings.LANGUAGE_CODE_EN)
    context['experimental_phase'] = True
    return layout.render(request, "learning_unit/pedagogy.html", context)
コード例 #6
0
ファイル: learning_unit.py プロジェクト: neamatKhan/osis
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)
コード例 #7
0
ファイル: learning_unit.py プロジェクト: neamatKhan/osis
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)
コード例 #8
0
def learning_unit_summary(request, learning_unit_year_id):
    if not is_summary_submission_opened():
        return redirect(reverse_lazy('outside_summary_submission_period'))

    learning_unit_year = get_object_or_404(LearningUnitYear,
                                           pk=learning_unit_year_id)
    if not can_access_summary(request.user, learning_unit_year):
        raise PermissionDenied("User is not summary responsible")

    user_language = mdl.person.get_user_interface_language(request.user)
    return layout.render(
        request, "my_osis/educational_information.html", {
            'learning_unit_year':
            learning_unit_year,
            'cms_labels_translated':
            get_cms_label_data(CMS_LABEL_SUMMARY, user_language),
            'form_french':
            initialize_learning_unit_pedagogy_form(learning_unit_year,
                                                   settings.LANGUAGE_CODE_FR),
            'form_english':
            initialize_learning_unit_pedagogy_form(learning_unit_year,
                                                   settings.LANGUAGE_CODE_EN)
        })