From e706407bcbcdfaeccc1353342a08377224ca29ef Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 18 Nov 2021 23:53:57 +0100 Subject: [PATCH] Ajoute relations: inscriptions etuds --- app/models/formsemestre.py | 9 +++++++++ app/models/moduleimpls.py | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index eef37102..61b5ff65 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -16,6 +16,7 @@ import app.scodoc.notesdb as ndb from app.scodoc import sco_evaluation_db from app.models.formations import UniteEns, Module from app.models.moduleimpls import ModuleImpl +from app.models.etudiants import Identite class FormSemestre(db.Model): @@ -255,6 +256,14 @@ class FormsemestreInscription(db.Model): db.Integer, db.ForeignKey("notes_formsemestre.id"), ) + etud = db.relationship( + Identite, + backref=db.backref("formsemestre_inscriptions", cascade="all, delete-orphan"), + ) + formsemestre = db.relationship( + FormSemestre, + backref=db.backref("inscriptions", cascade="all, delete-orphan"), + ) # I inscrit, D demission en cours de semestre, DEF si "defaillant" etat = db.Column(db.String(CODE_STR_LEN)) # etape apogee d'inscription (experimental 2020) diff --git a/app/models/moduleimpls.py b/app/models/moduleimpls.py index 66568802..b8478679 100644 --- a/app/models/moduleimpls.py +++ b/app/models/moduleimpls.py @@ -8,7 +8,7 @@ from app import db from app.models import APO_CODE_STR_LEN from app.models import SHORT_STR_LEN from app.models import CODE_STR_LEN -from app.models import UniteEns +from app.models import UniteEns, Identite import app.scodoc.notesdb as ndb from app.scodoc import sco_evaluation_db @@ -64,3 +64,11 @@ class ModuleImplInscription(db.Model): index=True, ) etudid = db.Column(db.Integer, db.ForeignKey("identite.id"), index=True) + etud = db.relationship( + Identite, + backref=db.backref("moduleimpl_inscriptions", cascade="all, delete-orphan"), + ) + moduleimpl = db.relationship( + ModuleImpl, + backref=db.backref("inscriptions", cascade="all, delete-orphan"), + )