From 89c03d64a028bc719b00eda3d874c09bc3ded13a Mon Sep 17 00:00:00 2001 From: hypsug0 Date: Thu, 21 Nov 2024 00:04:52 +0100 Subject: [PATCH] add id_obs in admin - fix #425 --- backend/gncitizen/core/observations/admin.py | 6 ++++-- backend/gncitizen/core/sites/admin.py | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/gncitizen/core/observations/admin.py b/backend/gncitizen/core/observations/admin.py index 78a21274..45a6a984 100644 --- a/backend/gncitizen/core/observations/admin.py +++ b/backend/gncitizen/core/observations/admin.py @@ -1,8 +1,7 @@ from flask_admin.actions import action -from wtforms import SelectField - from gncitizen.utils.admin import CustomJSONField, CustomTileView, json_formatter from server import db +from wtforms import SelectField from .models import ObservationModel, ValidationStatus @@ -15,6 +14,7 @@ def enum_formatter(view, context, model, name): class ObservationView(CustomTileView): can_export = True # column_exclude_list = ["geom"] + column_display_pk = True form_overrides = {"json_schema": CustomJSONField, "validation_status": SelectField} form_args = { "validation_status": { @@ -27,6 +27,7 @@ class ObservationView(CustomTileView): "validation_status": enum_formatter, } column_filters = ( + "id_observation", "email", "cd_nom", "date", @@ -45,6 +46,7 @@ class ObservationView(CustomTileView): "municipality", "obs_txt", "email", + "uuid_sinp", ) can_create = False diff --git a/backend/gncitizen/core/sites/admin.py b/backend/gncitizen/core/sites/admin.py index f01cdabf..c7f91a84 100644 --- a/backend/gncitizen/core/sites/admin.py +++ b/backend/gncitizen/core/sites/admin.py @@ -1,9 +1,8 @@ """Flask-Admin views for site module""" from flask_admin.contrib.sqla.view import ModelView -from markupsafe import Markup - from gncitizen.utils.admin import CustomJSONField, CustomTileView, json_formatter +from markupsafe import Markup from .models import VisitModel @@ -20,9 +19,9 @@ class SiteView(CustomTileView): VisitModel, ] column_formatters = {"visits": _visits_list_formatter} - # column_exclude_list = ["geom"] column_list = [ "id_site", + "uuid_sinp", "name", "visits", "site_type.type",