Ajout des annotations dans l'API #857

Merged
viennet merged 4 commits from :api-annot into master 2024-02-11 10:09:52 +01:00
1 changed files with 12 additions and 0 deletions
Showing only changes of commit 677415fbfc - Show all commits

View File

@ -518,6 +518,12 @@ class Identite(models.ScoDocModel):
e["dept_acronym"] = self.departement.acronym
e.pop("departement", None)
e["sort_key"] = self.sort_key
e["annotations"] = [
annot.to_dict()
for annot in EtudAnnotation.query.filter_by(etudid=self.id).order_by(
desc(EtudAnnotation.date)
)
]
if restrict:
# Met à None les attributs protégés:
for attr in self.protected_attrs:
@ -1076,6 +1082,12 @@ class EtudAnnotation(db.Model):
author = db.Column(db.Text) # le pseudo (user_name), was zope_authenticated_user
comment = db.Column(db.Text)
def to_dict(self):
"""Représentation dictionnaire."""
e = dict(self.__dict__)
e.pop("_sa_instance_state", None)
return e
from app.models.formsemestre import FormSemestre
from app.models.modules import Module