Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(api): remove id_type in admin #22

Merged
merged 1 commit into from
Jan 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions backend/gn_module_monitoring/monitoring/admin.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
from flask_admin.contrib.sqla import ModelView
from geonature.core.admin.admin import CruvedProtectedMixin
from geonature.core.gn_commons.models import TNomenclatures
from geonature.utils.env import DB
from pypnnomenclature.models import TNomenclatures, BibNomenclaturesTypes

from gn_module_monitoring.monitoring.models import BibCategorieSite


SITE_TYPE = "TYPE_SITE"


class BibCategorieSiteView(CruvedProtectedMixin, ModelView):
"""
Surcharge de l'administration des catégories de sites
Expand All @@ -21,7 +24,8 @@ def __init__(self, session, **kwargs):
def get_only_type_site_asc():
return (
DB.session.query(TNomenclatures)
.filter(TNomenclatures.id_type == 116)
.join(TNomenclatures.nomenclature_type)
.filter(BibNomenclaturesTypes.mnemonique == SITE_TYPE)
.order_by(TNomenclatures.label_fr.asc())
)

Expand Down