Ajoute relations: inscriptions etuds

This commit is contained in:
Emmanuel Viennet 2021-11-18 23:53:57 +01:00
parent 01ea6286ee
commit e706407bcb
2 changed files with 18 additions and 1 deletions

View File

@ -16,6 +16,7 @@ import app.scodoc.notesdb as ndb
from app.scodoc import sco_evaluation_db from app.scodoc import sco_evaluation_db
from app.models.formations import UniteEns, Module from app.models.formations import UniteEns, Module
from app.models.moduleimpls import ModuleImpl from app.models.moduleimpls import ModuleImpl
from app.models.etudiants import Identite
class FormSemestre(db.Model): class FormSemestre(db.Model):
@ -255,6 +256,14 @@ class FormsemestreInscription(db.Model):
db.Integer, db.Integer,
db.ForeignKey("notes_formsemestre.id"), 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" # I inscrit, D demission en cours de semestre, DEF si "defaillant"
etat = db.Column(db.String(CODE_STR_LEN)) etat = db.Column(db.String(CODE_STR_LEN))
# etape apogee d'inscription (experimental 2020) # etape apogee d'inscription (experimental 2020)

View File

@ -8,7 +8,7 @@ from app import db
from app.models import APO_CODE_STR_LEN from app.models import APO_CODE_STR_LEN
from app.models import SHORT_STR_LEN from app.models import SHORT_STR_LEN
from app.models import CODE_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 import app.scodoc.notesdb as ndb
from app.scodoc import sco_evaluation_db from app.scodoc import sco_evaluation_db
@ -64,3 +64,11 @@ class ModuleImplInscription(db.Model):
index=True, index=True,
) )
etudid = db.Column(db.Integer, db.ForeignKey("identite.id"), 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"),
)