From e6a165b18a1e26d04d34909ec38914a594424553 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 4 Jul 2024 14:55:02 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20cr=C3=A9ation=20module=20avec=20parcours?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/modules.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/modules.py b/app/models/modules.py index d0b159b7..0870a392 100644 --- a/app/models/modules.py +++ b/app/models/modules.py @@ -142,8 +142,10 @@ class Module(models.ScoDocModel): @classmethod def create_from_dict(cls, data: dict) -> "Module": - """Create from given dict, add parcours""" + """Create from given dict, add parcours. + Flush session.""" module = super().create_from_dict(data) + db.session.flush() module._set_parcours_from_list(data.get("parcours", []) or []) return module