forked from ScoDoc/ScoDoc
Ajout des annotations dans l'API
This commit is contained in:
parent
6cbeeedb1c
commit
677415fbfc
@ -518,6 +518,12 @@ class Identite(models.ScoDocModel):
|
|||||||
e["dept_acronym"] = self.departement.acronym
|
e["dept_acronym"] = self.departement.acronym
|
||||||
e.pop("departement", None)
|
e.pop("departement", None)
|
||||||
e["sort_key"] = self.sort_key
|
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:
|
if restrict:
|
||||||
# Met à None les attributs protégés:
|
# Met à None les attributs protégés:
|
||||||
for attr in self.protected_attrs:
|
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
|
author = db.Column(db.Text) # le pseudo (user_name), was zope_authenticated_user
|
||||||
comment = db.Column(db.Text)
|
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.formsemestre import FormSemestre
|
||||||
from app.models.modules import Module
|
from app.models.modules import Module
|
||||||
|
Loading…
Reference in New Issue
Block a user