diff --git a/VERSION b/VERSION index 61ce01b3..01b75682 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.13.2 +1.13.3 diff --git a/apptax/app.py b/apptax/app.py index aad75940..990f2012 100644 --- a/apptax/app.py +++ b/apptax/app.py @@ -11,10 +11,9 @@ from sqlalchemy.exc import OperationalError, ProgrammingError from sqlalchemy.orm.exc import NoResultFound +from apptax.database import db # must be before pynpnusershub import !! from pypnusershub.login_manager import login_manager -from apptax.database import db - migrate = Migrate() diff --git a/apptax/taxonomie/models.py b/apptax/taxonomie/models.py index a95c89c8..35e261df 100644 --- a/apptax/taxonomie/models.py +++ b/apptax/taxonomie/models.py @@ -23,10 +23,13 @@ class BibNoms(db.Model): comments = db.Column(db.Unicode) taxref = db.relationship("Taxref", back_populates="bib_nom") - attributs = db.relationship("CorTaxonAttribut") - listes = db.relationship("CorNomListe") + attributs = db.relationship("CorTaxonAttribut", back_populates="bib_nom") + listes = db.relationship("CorNomListe", back_populates="bib_nom") # medias relationship defined through backref + def __repr__(self): + return f"" + @serializable class CorTaxonAttribut(db.Model): @@ -45,11 +48,11 @@ class CorTaxonAttribut(db.Model): primary_key=True, ) valeur_attribut = db.Column(db.Text, nullable=False) - bib_nom = db.relationship("BibNoms") + bib_nom = db.relationship("BibNoms", back_populates="attributs") bib_attribut = db.relationship("BibAttributs") def __repr__(self): - return "" % self.valeur_attribut + return f"" @serializable @@ -61,10 +64,10 @@ class BibThemes(db.Model): desc_theme = db.Column(db.Unicode) ordre = db.Column(db.Integer) id_droit = db.Column(db.Integer) - attributs = db.relationship("BibAttributs", lazy="select") + attributs = db.relationship("BibAttributs", lazy="select", back_populates="theme") def __repr__(self): - return "" % self.nom_theme + return f"" @serializable @@ -88,10 +91,10 @@ class BibAttributs(db.Model): primary_key=False, ) ordre = db.Column(db.Integer) - theme = db.relationship(BibThemes) + theme = db.relationship(BibThemes, back_populates="attributs") def __repr__(self): - return "" % self.nom_attribut + return f"" @serializable(exclude=["nom_vern_or_lb_nom"]) @@ -125,7 +128,7 @@ class Taxref(db.Model): group3_inpn = db.Column(db.Unicode) url = db.Column(db.Unicode) - bib_nom = db.relationship("BibNoms", back_populates="taxref") + bib_nom = db.relationship(BibNoms, back_populates="taxref") @hybrid_property def nom_vern_or_lb_nom(self): @@ -136,7 +139,7 @@ def nom_vern_or_lb_nom(cls): return db.func.coalesce(cls.nom_vern, cls.lb_nom) def __repr__(self): - return "" % self.nom_complet + return f"" @serializable @@ -155,11 +158,11 @@ class CorNomListe(db.Model): nullable=False, primary_key=True, ) - bib_nom = db.relationship("BibNoms") - bib_liste = db.relationship("BibListes") + bib_nom = db.relationship(BibNoms, back_populates="listes") + bib_liste = db.relationship("BibListes", back_populates="cnl") def __repr__(self): - return "" % self.id_liste + return f"" @serializable @@ -174,11 +177,13 @@ class BibListes(db.Model): regne = db.Column(db.Unicode) group2_inpn = db.Column(db.Unicode) - cnl = db.relationship("CorNomListe", lazy="select") - noms = db.relationship("BibNoms", secondary=CorNomListe.__table__) + cnl = db.relationship(CorNomListe, lazy="select", back_populates="bib_liste") + noms = db.relationship( + "BibNoms", secondary=CorNomListe.__table__, overlaps="bib_nom,listes,bib_liste,cnl" + ) def __repr__(self): - return "" % self.nom_liste + return f"" @serializable @@ -190,7 +195,7 @@ class BibTypesMedia(db.Model): desc_type_media = db.Column(db.Text) def __repr__(self): - return "" % self.nom_type_media + return f"" @serializable @@ -223,7 +228,7 @@ class TMedias(db.Model): bib_nom = db.relationship(BibNoms, backref="medias") def __repr__(self): - return "" % self.titre + return f"" @serializable @@ -243,7 +248,7 @@ class VMTaxrefListForautocomplete(db.Model): group3_inpn = db.Column(db.Unicode) def __repr__(self): - return "" % self.search_name + return f"" @serializable @@ -255,7 +260,7 @@ class BibTaxrefHabitats(db.Model): desc_habitat = db.Column(db.Text) def __repr__(self): - return "" % self.nom_habitat + return f"" @serializable @@ -267,7 +272,7 @@ class BibTaxrefRangs(db.Model): tri_rang = db.Column(db.Integer) def __repr__(self): - return "" % self.nom_rang + return f"" @serializable @@ -278,7 +283,7 @@ class BibTaxrefStatus(db.Model): nom_statut = db.Column(db.Unicode) def __repr__(self): - return "" % self.nom_statut + return f"" @serializable @@ -301,7 +306,7 @@ class VMTaxrefHierarchie(db.Model): nb_tx_kd = db.Column(db.Integer) def __repr__(self): - return "" % self.lb_nom + return f"" @serializable @@ -323,7 +328,7 @@ class VTaxrefHierarchieBibtaxons(db.Model): nb_tx_kd = db.Column(db.Integer) def __repr__(self): - return "" % self.lb_nom + return f"" @serializable @@ -336,7 +341,7 @@ class TaxrefBdcStatutType(db.Model): thematique = db.Column(db.Unicode) type_value = db.Column(db.Unicode) - text = db.relationship("TaxrefBdcStatutText", lazy="select") + text = db.relationship("TaxrefBdcStatutText", lazy="select", back_populates="type_statut") @hybrid_property def display(self): @@ -372,8 +377,10 @@ class TaxrefBdcStatutText(db.Model): doc_url = db.Column(db.Unicode) enable = db.Column(db.Boolean) - type_statut = db.relationship("TaxrefBdcStatutType", lazy="select") - cor_text = db.relationship("TaxrefBdcStatutCorTextValues", lazy="select") + type_statut = db.relationship(TaxrefBdcStatutType, lazy="select", back_populates="text") + cor_text = db.relationship( + "TaxrefBdcStatutCorTextValues", lazy="select", back_populates="text" + ) areas = db.relationship(LAreas, secondary=bdc_statut_cor_text_area) @@ -403,10 +410,10 @@ class TaxrefBdcStatutCorTextValues(db.Model): db.Unicode, ForeignKey("taxonomie.bdc_statut_text.id_text"), nullable=False ) - text = db.relationship("TaxrefBdcStatutText", lazy="select") - value = db.relationship("TaxrefBdcStatutValues", lazy="select") + text = db.relationship(TaxrefBdcStatutText, lazy="select", back_populates="cor_text") + value = db.relationship(TaxrefBdcStatutValues, lazy="select") - taxon = db.relationship("TaxrefBdcStatutTaxon", lazy="select") + taxon = db.relationship("TaxrefBdcStatutTaxon", lazy="select", back_populates="value_text") @serializable @@ -423,7 +430,9 @@ class TaxrefBdcStatutTaxon(db.Model): cd_ref = db.Column(db.Integer) rq_statut = db.Column(db.Unicode) - value_text = db.relationship("TaxrefBdcStatutCorTextValues", lazy="select") + value_text = db.relationship( + TaxrefBdcStatutCorTextValues, lazy="select", back_populates="taxon" + ) @serializable diff --git a/docs/changelog.md b/docs/changelog.md index b3eb8a97..34ca21f2 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,3 +1,12 @@ +1.13.3 (2024-02-12) +================== + +**🐛 Corrections** + +* Correction du problème de connexion sur TaxHub quand celui-ci est lancé avec le service (#476) +* Suppression de warnings SQLAlchemy 1.4 (#477) + + 1.13.2 (2024-01-30) ===================