diff --git a/backend/gn_module_monitoring/monitoring/queries.py b/backend/gn_module_monitoring/monitoring/queries.py index f22847829..c3eb3809a 100644 --- a/backend/gn_module_monitoring/monitoring/queries.py +++ b/backend/gn_module_monitoring/monitoring/queries.py @@ -16,6 +16,7 @@ from geonature.core.gn_permissions.tools import get_scopes_by_action from pypnnomenclature.models import TNomenclatures +from geonature.core.gn_monitoring.models import BibTypeSite import gn_module_monitoring.monitoring.models as Models @@ -128,7 +129,7 @@ def filter_by_params(cls, query: Select, params: MultiDict = None, **kwargs): if not isinstance(value, list): value = [value] query = query.filter( - cls.types_site.any(Models.BibTypeSite.id_nomenclature_type_site.in_(value)) + cls.types_site.any(BibTypeSite.id_nomenclature_type_site.in_(value)) ) query = super().filter_by_params(query, params) @@ -149,9 +150,7 @@ def filter_by_specific( # Get specific specific_config_models = ( db.session.scalars( - select(Models.BibTypeSite).where( - Models.BibTypeSite.id_nomenclature_type_site.in_(id_types_site) - ) + select(BibTypeSite).where(BibTypeSite.id_nomenclature_type_site.in_(id_types_site)) ) .unique() .all() @@ -270,9 +269,7 @@ def filter_by_params(cls, query: Select, params: MultiDict = None, **kwargs): query = query.join(join_sites, cls.sites) query = query.filter( - join_sites.types_site.any( - Models.BibTypeSite.id_nomenclature_type_site.in_(value) - ) + join_sites.types_site.any(BibTypeSite.id_nomenclature_type_site.in_(value)) ) return query