forked from ScoDoc/ScoDoc
export champs manquants pour bulletins
This commit is contained in:
parent
c652bbf2f6
commit
33d9257604
@ -145,32 +145,37 @@ class Identite(db.Model):
|
|||||||
return {k: e[k] or "" for k in e} # convert_null_outputs_to_empty
|
return {k: e[k] or "" for k in e} # convert_null_outputs_to_empty
|
||||||
|
|
||||||
def to_dict_bul(self, include_urls=True):
|
def to_dict_bul(self, include_urls=True):
|
||||||
"""Infos exportées dans les bulletins"""
|
"""Infos exportées dans les bulletins
|
||||||
|
L'étudiant, et sa première adresse.
|
||||||
|
"""
|
||||||
from app.scodoc import sco_photos
|
from app.scodoc import sco_photos
|
||||||
|
|
||||||
d = {
|
d = {
|
||||||
"civilite": self.civilite,
|
"civilite": self.civilite,
|
||||||
"code_ine": self.code_ine,
|
"code_ine": self.code_ine or "",
|
||||||
"code_nip": self.code_nip,
|
"code_nip": self.code_nip or "",
|
||||||
"date_naissance": self.date_naissance.isoformat()
|
"date_naissance": self.date_naissance.strftime("%d/%m/%Y")
|
||||||
if self.date_naissance
|
if self.date_naissance
|
||||||
else None,
|
else "",
|
||||||
"email": self.get_first_email(),
|
"email": self.get_first_email() or "",
|
||||||
"emailperso": self.get_first_email("emailperso"),
|
"emailperso": self.get_first_email("emailperso"),
|
||||||
"etudid": self.id,
|
"etudid": self.id,
|
||||||
"nom": self.nom_disp(),
|
"nom": self.nom_disp(),
|
||||||
"prenom": self.prenom,
|
"prenom": self.prenom or "",
|
||||||
"nomprenom": self.nomprenom,
|
"nomprenom": self.nomprenom or "",
|
||||||
"lieu_naissance": self.lieu_naissance,
|
"lieu_naissance": self.lieu_naissance or "",
|
||||||
"dept_naissance": self.dept_naissance,
|
"dept_naissance": self.dept_naissance or "",
|
||||||
"nationalite": self.nationalite,
|
"nationalite": self.nationalite or "",
|
||||||
"boursier": self.boursier,
|
"boursier": self.boursier or "",
|
||||||
}
|
}
|
||||||
if include_urls:
|
if include_urls:
|
||||||
d["fiche_url"] = url_for(
|
d["fiche_url"] = url_for(
|
||||||
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=self.id
|
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=self.id
|
||||||
)
|
)
|
||||||
d["photo_url"] = (sco_photos.get_etud_photo_url(self.id),)
|
d["photo_url"] = sco_photos.get_etud_photo_url(self.id)
|
||||||
|
adresse = self.adresses.first()
|
||||||
|
if adresse:
|
||||||
|
d.update(adresse.to_dict(convert_nulls_to_str=True))
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def inscription_courante(self):
|
def inscription_courante(self):
|
||||||
@ -392,6 +397,14 @@ class Adresse(db.Model):
|
|||||||
)
|
)
|
||||||
description = db.Column(db.Text)
|
description = db.Column(db.Text)
|
||||||
|
|
||||||
|
def to_dict(self, convert_nulls_to_str=False):
|
||||||
|
"""Représentation dictionnaire,"""
|
||||||
|
e = dict(self.__dict__)
|
||||||
|
e.pop("_sa_instance_state", None)
|
||||||
|
if convert_nulls_to_str:
|
||||||
|
return {k: e[k] or "" for k in e}
|
||||||
|
return e
|
||||||
|
|
||||||
|
|
||||||
class Admission(db.Model):
|
class Admission(db.Model):
|
||||||
"""Informations liées à l'admission d'un étudiant"""
|
"""Informations liées à l'admission d'un étudiant"""
|
||||||
|
Loading…
Reference in New Issue
Block a user