diff --git a/app/models/formations.py b/app/models/formations.py index 5bd4a8d963..d4aac9ad29 100644 --- a/app/models/formations.py +++ b/app/models/formations.py @@ -64,7 +64,7 @@ class Formation(db.Model): return f"""Formation {self.titre} ({self.acronyme}) [version {self.version}] code {self.formation_code}""" def to_dict(self, with_refcomp_attrs=False): - """ "as a dict. + """As a dict. Si with_refcomp_attrs, ajoute attributs permettant de retrouver le ref. de comp. """ e = dict(self.__dict__) diff --git a/app/scodoc/sco_formations.py b/app/scodoc/sco_formations.py index 9be52db4bd..93f6473469 100644 --- a/app/scodoc/sco_formations.py +++ b/app/scodoc/sco_formations.py @@ -119,6 +119,7 @@ def formation_export( formation: Formation = Formation.query.get_or_404(formation_id) f_dict = formation.to_dict(with_refcomp_attrs=True) if not export_ids: + del f_dict["id"] del f_dict["formation_id"] del f_dict["dept_id"] ues = formation.ues diff --git a/tests/unit/test_formations.py b/tests/unit/test_formations.py index c91a4cf873..38a40378db 100644 --- a/tests/unit/test_formations.py +++ b/tests/unit/test_formations.py @@ -178,7 +178,7 @@ def test_formations(test_client): # --- Export de formation_id exp = sco_formations.formation_export( - formation_id=formation_id, format="json" + formation_id=formation_id, format="json", export_ids=True ).get_data(as_text=True) assert isinstance(exp, str) load_exp = json.loads(exp)