From 9adb5a62929e0ce9f0f6adac45be6005e19dc7d8 Mon Sep 17 00:00:00 2001 From: Nekori Date: Fri, 11 Jun 2021 14:34:43 +0200 Subject: [PATCH] Fix: "Code" longueur max = 32 --- app/models.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/app/models.py b/app/models.py index 39bb8c7..780d04f 100644 --- a/app/models.py +++ b/app/models.py @@ -1,28 +1,28 @@ from app import db Semestres_Competences = db.Table("Semestres_Competences", - db.Column("Semestre_num", db.String(1), db.ForeignKey("semestre.num")), - db.Column("Competence_code", db.String(3), db.ForeignKey("competence.code")) + db.Column("Semestre_num", db.String(32), db.ForeignKey("semestre.num")), + db.Column("Competence_code", db.String(32), db.ForeignKey("competence.code")) ) ACs_Competences = db.Table("ACs_Competences", - db.Column("AC_code", db.String(6), db.ForeignKey("AC.code")), - db.Column("Competence_code", db.String(3), db.ForeignKey("competence.code")) + db.Column("AC_code", db.String(32), db.ForeignKey("AC.code")), + db.Column("Competence_code", db.String(32), db.ForeignKey("competence.code")) ) 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")) + db.Column("Ressource_code", db.String(32), db.ForeignKey("ressource.code")), + db.Column("AC_code", db.String(32), 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")) + db.Column("Ressource_code", db.String(32), db.ForeignKey("ressource.code")), + db.Column("SAE_code", db.String(32), 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")) + db.Column("SAE_code", db.String(32), db.ForeignKey("SAE.code")), + db.Column("AC_code", db.String(32), db.ForeignKey("AC.code")) ) class Semestre(db.Model): @@ -38,7 +38,7 @@ class Semestre(db.Model): return "".format(self.num) class Competence(db.Model): - code = db.Column(db.String(3), primary_key = True, info={'label': 'Code'}) + code = db.Column(db.String(32), primary_key = True, info={'label': 'Code'}) nom = db.Column(db.String(255), info={'label': 'Nom'}) diminutif = db.Column(db.String(30), info={'label': 'Diminutif'}) description = db.Column(db.Text(), info={'label': 'Description'}) @@ -85,8 +85,8 @@ class Competence(db.Model): return "".format(self.code) class CoefSAE(db.Model): - competence_code = db.Column(db.String(3), db.ForeignKey("competence.code"), primary_key=True) - sae_code = db.Column(db.String(6), db.ForeignKey("SAE.code"), primary_key=True) + competence_code = db.Column(db.String(32), db.ForeignKey("competence.code"), primary_key=True) + sae_code = db.Column(db.String(32), db.ForeignKey("SAE.code"), primary_key=True) coef = db.Column(db.String(2)) competence = db.relationship("Competence", lazy=False, backref=db.backref("saes")) sae = db.relationship("SAE", lazy=False, backref=db.backref("competences")) @@ -97,8 +97,8 @@ class CoefSAE(db.Model): return result class CoefRessource(db.Model): - competence_code = db.Column(db.String(3), db.ForeignKey("competence.code"), primary_key=True) - ressource_code = db.Column(db.String(4), db.ForeignKey("ressource.code"), primary_key=True) + competence_code = db.Column(db.String(32), db.ForeignKey("competence.code"), primary_key=True) + ressource_code = db.Column(db.String(32), db.ForeignKey("ressource.code"), primary_key=True) coef = db.Column(db.String(2)) competence = db.relationship("Competence", lazy=False, backref=db.backref("ressources")) ressource = db.relationship("Ressource", lazy=False, backref=db.backref("competences")) @@ -109,7 +109,7 @@ class CoefRessource(db.Model): return result class AC(db.Model): - code = db.Column(db.String(6), primary_key = True, info={'label': 'Code'}) + code = db.Column(db.String(32), primary_key = True, info={'label': 'Code'}) titre = db.Column(db.String(255), info={'label': 'Titre'}) saes = db.relationship("SAE", secondary=SAEs_ACs, lazy=False, backref=db.backref("acs", lazy=False)) ressources = db.relationship("Ressource", order_by="Ressource.code", secondary=Ressources_ACs, lazy=False, backref=db.backref("acs", lazy=False)) @@ -126,7 +126,7 @@ class AC(db.Model): return "".format(self.code) class PN(db.Model): - code = db.Column(db.String(3), primary_key = True, info={'label': 'Code'}) + code = db.Column(db.String(32), primary_key = True, info={'label': 'Code'}) nom = db.Column(db.String(255), info={'label': 'Nom'}) diminutif = db.Column(db.String(30), info={'label': 'Diminutif'}) description = db.Column(db.Text(), info={'label': 'Description'}) @@ -141,7 +141,7 @@ class PN(db.Model): return "".format(self.code) class SAE(db.Model): - code = db.Column(db.String(5), primary_key = True, info={'label': 'Code'}) + code = db.Column(db.String(32), primary_key = True, info={'label': 'Code'}) titre = db.Column(db.String(255), info={'label': 'Titre'}) semestre = db.Column(db.String(255), info={'label': 'Semestre'}) heures_encadrees = db.Column(db.String(3), info={'label': 'Heures Encadrées'}) @@ -173,7 +173,7 @@ class SAE(db.Model): return "".format(self.code) class Ressource(db.Model): - code = db.Column(db.String(4), primary_key = True, info={'label': 'Code'}) + code = db.Column(db.String(32), primary_key = True, info={'label': 'Code'}) nom = db.Column(db.String(255), info={'label': 'Nom'}) semestre = db.Column(db.String(255), info={'label': 'Semestre'}) heures_formation = db.Column(db.String(3), info={'label': 'Heures Formation'})