Exemple #1
0
def generate_ue_contained_for_workbook(custom_xls_form: CustomXlsForm,
                                       qs: QuerySet):
    data = _build_excel_lines_ues(custom_xls_form, qs)
    need_proposal_legend = custom_xls_form.is_valid(
    ) and custom_xls_form.cleaned_data['proposition']

    return _get_workbook_for_custom_xls(data.get('content'),
                                        need_proposal_legend,
                                        data.get('colored_cells'),
                                        data.get('row_height'))
Exemple #2
0
    def __init__(self, egy: EducationGroupYear,
                 custom_xls_form: CustomXlsForm):
        self.egy = egy
        self.hierarchy = EducationGroupHierarchy(root=self.egy)
        self.learning_unit_years_parent = []

        for grp in self.hierarchy.included_group_element_years:
            if not grp.child_leaf:
                continue
            self.learning_unit_years_parent.append(grp)
        self.custom_xls_form = custom_xls_form
        self._get_ordered_queryset()
        description_fiche = False
        specifications = False

        if custom_xls_form.is_valid():
            description_fiche = True if 'description_fiche' in custom_xls_form.fields else False
            specifications = True if 'specifications' in custom_xls_form.fields else False

        if description_fiche or specifications:
            self.qs = _annotate_with_description_fiche_specifications(
                self.qs, description_fiche, specifications)