Skip to content

Commit

Permalink
Merge pull request PnX-SI#479 from PnX-SI/develop
Browse files Browse the repository at this point in the history
1.13.3 release
  • Loading branch information
jacquesfize authored Feb 12, 2024
2 parents 2dfde0d + 17d89bf commit 366dd86
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 34 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.13.2
1.13.3
3 changes: 1 addition & 2 deletions apptax/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
71 changes: 40 additions & 31 deletions apptax/taxonomie/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"<BibNoms {self.nom_francais}>"


@serializable
class CorTaxonAttribut(db.Model):
Expand All @@ -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 "<CorTaxonAttribut %r>" % self.valeur_attribut
return f"<CorTaxonAttribut {self.valeur_attribut}>"


@serializable
Expand All @@ -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 "<BibThemes %r>" % self.nom_theme
return f"<BibThemes {self.nom_theme}>"


@serializable
Expand All @@ -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 "<BibAttributs %r>" % self.nom_attribut
return f"<BibAttributs {self.nom_attribut}>"


@serializable(exclude=["nom_vern_or_lb_nom"])
Expand Down Expand Up @@ -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):
Expand All @@ -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 "<Taxref %r>" % self.nom_complet
return f"<Taxref {self.nom_complet}>"


@serializable
Expand All @@ -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 "<CorNomListe %r>" % self.id_liste
return f"<CorNomListe {self.id_liste}>"


@serializable
Expand All @@ -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 "<BibListes %r>" % self.nom_liste
return f"<BibListes {self.nom_liste}>"


@serializable
Expand All @@ -190,7 +195,7 @@ class BibTypesMedia(db.Model):
desc_type_media = db.Column(db.Text)

def __repr__(self):
return "<BibTypesMedia %r>" % self.nom_type_media
return f"<BibTypesMedia {self.nom_type_media}>"


@serializable
Expand Down Expand Up @@ -223,7 +228,7 @@ class TMedias(db.Model):
bib_nom = db.relationship(BibNoms, backref="medias")

def __repr__(self):
return "<TMedias %r>" % self.titre
return f"<TMedias {self.titre}>"


@serializable
Expand All @@ -243,7 +248,7 @@ class VMTaxrefListForautocomplete(db.Model):
group3_inpn = db.Column(db.Unicode)

def __repr__(self):
return "<VMTaxrefListForautocomplete %r>" % self.search_name
return f"<VMTaxrefListForautocomplete {self.search_name} >"


@serializable
Expand All @@ -255,7 +260,7 @@ class BibTaxrefHabitats(db.Model):
desc_habitat = db.Column(db.Text)

def __repr__(self):
return "<BibTaxrefHabitats %r>" % self.nom_habitat
return f"<BibTaxrefHabitats {self.nom_habitat}>"


@serializable
Expand All @@ -267,7 +272,7 @@ class BibTaxrefRangs(db.Model):
tri_rang = db.Column(db.Integer)

def __repr__(self):
return "<BibTaxrefRangs %r>" % self.nom_rang
return f"<BibTaxrefRangs {self.nom_rang}>"


@serializable
Expand All @@ -278,7 +283,7 @@ class BibTaxrefStatus(db.Model):
nom_statut = db.Column(db.Unicode)

def __repr__(self):
return "<BibTaxrefStatus %r>" % self.nom_statut
return f"<BibTaxrefStatus {self.nom_statut}>"


@serializable
Expand All @@ -301,7 +306,7 @@ class VMTaxrefHierarchie(db.Model):
nb_tx_kd = db.Column(db.Integer)

def __repr__(self):
return "<VMTaxrefHierarchie %r>" % self.lb_nom
return f"<VMTaxrefHierarchie {self.lb_nom}>"


@serializable
Expand All @@ -323,7 +328,7 @@ class VTaxrefHierarchieBibtaxons(db.Model):
nb_tx_kd = db.Column(db.Integer)

def __repr__(self):
return "<VMTaxrefHierarchie %r>" % self.lb_nom
return f"<VMTaxrefHierarchie {self.lb_nom}>"


@serializable
Expand All @@ -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):
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -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)
===================

Expand Down

0 comments on commit 366dd86

Please sign in to comment.