From cf283281323ad9ea518af0dfe03188fdfc974b2d Mon Sep 17 00:00:00 2001 From: TheoLechemia Date: Tue, 1 Aug 2023 11:03:18 +0200 Subject: [PATCH] force regne to null --- apptax/admin/admin_view.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apptax/admin/admin_view.py b/apptax/admin/admin_view.py index 1c954cba..f6ad11e0 100644 --- a/apptax/admin/admin_view.py +++ b/apptax/admin/admin_view.py @@ -155,6 +155,13 @@ class BibListesView(FlaskAdminProtectedMixin, ModelView): EndpointLinkRowAction("fa fa-download", ".import_cd_nom_view", "Populate list"), ] + def on_model_change(self, form, model, is_created): + """ + Force None on empty string regne + """ + if not model.regne.regne: + model.regne = None + def render(self, template, **kwargs): self.extra_js = [ url_for("configs.get_config"),