forked from ScoDoc/ScoDoc
Fix: AP formsemestre avec parcours
This commit is contained in:
parent
081ad0d5e9
commit
dbb1264863
@ -54,7 +54,7 @@ def formsemestre(formsemestre_id: int):
|
|||||||
formsemestre: FormSemestre = models.FormSemestre.query.filter_by(
|
formsemestre: FormSemestre = models.FormSemestre.query.filter_by(
|
||||||
id=formsemestre_id
|
id=formsemestre_id
|
||||||
).first_or_404()
|
).first_or_404()
|
||||||
data = formsemestre.to_dict()
|
data = formsemestre.to_dict(convert_parcours=True)
|
||||||
# Pour le moment on a besoin de fixer le departement
|
# Pour le moment on a besoin de fixer le departement
|
||||||
# pour accéder aux préferences
|
# pour accéder aux préferences
|
||||||
dept = Departement.query.get(formsemestre.dept_id)
|
dept = Departement.query.get(formsemestre.dept_id)
|
||||||
|
@ -141,7 +141,7 @@ class FormSemestre(db.Model):
|
|||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<{self.__class__.__name__} {self.id} {self.titre_num()}>"
|
return f"<{self.__class__.__name__} {self.id} {self.titre_num()}>"
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self, convert_parcours=False):
|
||||||
"dict (compatible ScoDoc7)"
|
"dict (compatible ScoDoc7)"
|
||||||
d = dict(self.__dict__)
|
d = dict(self.__dict__)
|
||||||
d.pop("_sa_instance_state", None)
|
d.pop("_sa_instance_state", None)
|
||||||
@ -160,6 +160,8 @@ class FormSemestre(db.Model):
|
|||||||
d["date_fin"] = d["date_fin_iso"] = ""
|
d["date_fin"] = d["date_fin_iso"] = ""
|
||||||
d["responsables"] = [u.id for u in self.responsables]
|
d["responsables"] = [u.id for u in self.responsables]
|
||||||
d["titre_formation"] = self.titre_formation()
|
d["titre_formation"] = self.titre_formation()
|
||||||
|
if convert_parcours:
|
||||||
|
d["parcours"] = [p.to_dict() for p in self.parcours]
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def get_infos_dict(self) -> dict:
|
def get_infos_dict(self) -> dict:
|
||||||
|
Loading…
Reference in New Issue
Block a user