From e01064cb8dca910acac3facc5c2538bf00625a4c 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 6b8fc138..e3cf59dd 100644 --- a/apptax/admin/admin_view.py +++ b/apptax/admin/admin_view.py @@ -154,6 +154,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"),