diff --git a/apptax/admin/filters.py b/apptax/admin/filters.py index 902d4386..6812c7b9 100644 --- a/apptax/admin/filters.py +++ b/apptax/admin/filters.py @@ -57,7 +57,7 @@ def get_dynamic_options(self, view): class FilterBiblist(DynamicOptionsMixin, FilterEqual): def apply(self, query, value, alias=None): - return query.join(Taxref.liste).filter(Taxref.liste.any(id_liste=value)) + return query.join(Taxref.listes).filter(Taxref.listes.any(id_liste=value)) def get_dynamic_options(self, view): if has_app_context(): diff --git a/apptax/taxonomie/models.py b/apptax/taxonomie/models.py index 72633c36..c7d8f76b 100644 --- a/apptax/taxonomie/models.py +++ b/apptax/taxonomie/models.py @@ -54,7 +54,7 @@ class CorTaxonAttribut(db.Model): valeur_attribut = db.Column(db.Text, nullable=False) bib_attribut = db.relationship("BibAttributs") - taxon = db.relationship("Taxref", backref="attributs") + taxon = db.relationship("Taxref", back_populates="attributs") def __repr__(self): return self.valeur_attribut @@ -174,6 +174,9 @@ class Taxref(db.Model): foreign_keys=[cd_ref], primaryjoin="Taxref.cd_ref == Taxref.cd_ref", ) + attributs = db.relationship("CorTaxonAttribut", back_populates="taxon") + listes = db.relationship("BibListes", secondary=cor_nom_liste, back_populates="noms") + medias = db.relationship("apptax.taxonomie.models.TMedias", back_populates="taxon") @hybrid_property def nom_vern_or_lb_nom(self): @@ -210,7 +213,7 @@ class BibListes(db.Model): primary_key=False, ) - noms = db.relationship("Taxref", secondary=cor_nom_liste, backref="liste") + noms = db.relationship("Taxref", secondary=cor_nom_liste, back_populates="listes") regne = db.relationship("VMRegne") group2_inpn = db.relationship("VMGroup2Inpn") @@ -270,7 +273,7 @@ class TMedias(db.Model): types = db.relationship(BibTypesMedia) - taxon = db.relationship(Taxref, backref="medias") + taxon = db.relationship(Taxref, back_populates="medias") def __repr__(self): return self.titre