From 687ef08f95d38c7afae2acd290b28af86e43a8af Mon Sep 17 00:00:00 2001 From: Richard Hitier Date: Thu, 6 May 2021 15:13:24 +0200 Subject: [PATCH] Use checkboxes for boolean fields --- app/main/templates/agent.html | 2 -- app/main/templates/agent_edit.html | 16 +++++++++------- app/models.py | 6 +++++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/main/templates/agent.html b/app/main/templates/agent.html index e17edbd..362e9ad 100644 --- a/app/main/templates/agent.html +++ b/app/main/templates/agent.html @@ -52,8 +52,6 @@ {# TODO: put different spacing #}
-
APPRENTI
-
Fiche de poste :
{# TODO: put different spacing #} diff --git a/app/main/templates/agent_edit.html b/app/main/templates/agent_edit.html index 2919111..bbf541b 100644 --- a/app/main/templates/agent_edit.html +++ b/app/main/templates/agent_edit.html @@ -18,9 +18,15 @@ -
- - +
+ + +
+
+ +
@@ -38,10 +44,6 @@
-
- - -
{% endblock %} diff --git a/app/models.py b/app/models.py index cbc3013..5d2a612 100644 --- a/app/models.py +++ b/app/models.py @@ -111,7 +111,11 @@ class Agent(db.Model): :return: """ for key in self.export_keys: - setattr(self, key, form_request.form[key]) + # deal with checked value + if key in ['permanent', 'virtual']: + setattr(self, key, form_request.form.get(key)) + else: + setattr(self, key, form_request.form[key]) class Service(db.Model): -- libgit2 0.21.2