EditionPN/app/models.py

80 lines
3.0 KiB
Python

from app import db
Ressources_ACs = db.Table("Ressources_ACs",
db.Column("Ressource_code", db.String(4), db.ForeignKey("ressource.code")),
db.Column("AC_code", db.String(6), db.ForeignKey("AC.code"))
)
Ressources_SAEs = db.Table("Ressources_SAEs",
db.Column("Ressource_code", db.String(4), db.ForeignKey("ressource.code")),
db.Column("SAE_code", db.String(5), db.ForeignKey("SAE.code"))
)
SAEs_ACs = db.Table("SAEs_ACs",
db.Column("SAE_code", db.String(5), db.ForeignKey("SAE.code")),
db.Column("AC_code", db.String(6), db.ForeignKey("AC.code"))
)
class PN(db.Model):
code = db.Column(db.String(3), primary_key = True)
nom = db.Column(db.String(255))
diminutif = db.Column(db.String(30))
description = db.Column(db.Text())
type = db.Column(db.String(1))
def __repr__(self):
return "<PN {}>".format(self.code)
class AC(db.Model):
code = db.Column(db.String(6), primary_key = True)
titre = db.Column(db.String(255))
saes = db.relationship("SAE", secondary=SAEs_ACs, lazy=False, backref=db.backref("acs", lazy=False))
def __repr__(self):
return "<AC {}>".format(self.code)
class SAE(db.Model):
code = db.Column(db.String(5), primary_key = True)
titre = db.Column(db.String(255))
semestre = db.Column(db.String(255))
heures_encadrees = db.Column(db.String(3))
heures_tp = db.Column(db.String(3))
projet = db.Column(db.String(3))
description = db.Column(db.Text())
coef = db.Column(db.String(255))
#acs = db.relationship("AC", secondary=SAEs_ACs, lazy=True, backref=db.backref("saes", lazy=True))
ressources = db.relationship("Ressource", secondary=Ressources_SAEs, lazy=False, backref=db.backref("saes", lazy=False))
livrables = db.Column(db.Text())
motscles = db.Column(db.String(255))
def __repr__(self):
return "<SAE {}>".format(self.code)
class Ressource(db.Model):
code = db.Column(db.String(4), primary_key = True)
nom = db.Column(db.String(255))
semestre = db.Column(db.String(255))
heures_formation = db.Column(db.String(3))
heures_tp = db.Column(db.String(3))
coef = db.Column(db.String(255))
#acs = db.relationship("AC", secondary=Ressources_ACs, lazy=True, backref=db.backref("ressources", lazy=True))
#saes = db.relationship("SAE", secondary=Ressources_SAEs, lazy=True, backref=db.backref("ressources", lazy=True))
prerequis = db.Column(db.String(255))
contexte = db.Column(db.Text())
contenu = db.Column(db.Text())
motscles = db.Column(db.String(255))
def __repr__(self):
return "<Ressource {}>".format(self.code)
class Competence(db.Model):
code = db.Column(db.String(3), primary_key = True)
nom = db.Column(db.String(255))
diminutif = db.Column(db.String(30))
description = db.Column(db.Text())
composantes = db.Column(db.Text())
situations = db.Column(db.Text())
niveaux = db.Column(db.Text())
def __repr__(self):
return "<Compétence {}>".format(self.code)