Code source de geonature.core.taxonomie.admin

import os
from apptax.admin.admin_view import (
    BibListesView,
    TaxrefView,
    TMediasView,
    BibAttributsView,
    BibThemesView,
)
from geonature.utils.env import db

from apptax.admin.admin import adresses
from apptax.taxonomie.models import Taxref, BibListes, TMedias, BibAttributs, BibThemes
from geonature.core.admin.utils import CruvedProtectedMixin


[docs] class CruvedProtectedBibListesView(CruvedProtectedMixin, BibListesView):
[docs] module_code = "TAXHUB"
[docs] object_code = "LISTES"
[docs] extra_actions_perm = {".import_cd_nom_view": "C"}
[docs] class CruvedProtectedTaxrefView(CruvedProtectedMixin, TaxrefView):
[docs] module_code = "TAXHUB"
[docs] object_code = "TAXONS"
[docs] class CruvedProtectedTMediasView(CruvedProtectedMixin, TMediasView):
[docs] module_code = "TAXHUB"
[docs] object_code = "TAXONS"
[docs] class CruvedProtectedBibAttributsView(CruvedProtectedMixin, BibAttributsView):
[docs] module_code = "TAXHUB"
[docs] object_code = "ATTRIBUTS"
[docs] class CruvedProtectedBibThemes(CruvedProtectedMixin, BibThemesView):
[docs] module_code = "TAXHUB"
[docs] object_code = "THEMES"
[docs] def load_admin_views(app, admin): static_folder = os.path.join(adresses.root_path, "static") admin.add_view( CruvedProtectedTaxrefView( Taxref, db.session, name="Taxref", endpoint="taxons", category="TaxHub", static_folder=static_folder, ) ) admin.add_view( CruvedProtectedBibListesView( BibListes, db.session, name="Listes", category="TaxHub", static_folder=static_folder, ) ) admin.add_view( CruvedProtectedBibAttributsView( BibAttributs, db.session, name="Attributs", category="TaxHub", static_folder=static_folder, ) ) admin.add_view( CruvedProtectedBibThemes( BibThemes, db.session, name="Thèmes", category="TaxHub", static_folder=static_folder, ) ) admin.add_view( CruvedProtectedTMediasView( TMedias, db.session, name="Médias", category="TaxHub", static_folder=static_folder, ) )