From 139fec130e22cbf0b899992bce6bfb308b655696 Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Tue, 19 Nov 2024 17:26:39 +0000 Subject: [PATCH 1/2] fix inadvertently removed fields --- project/npda/templates/npda/visit_form.html | 37 +++++++++++---------- project/npda/templatetags/npda_tags.py | 16 +++++++++ 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/project/npda/templates/npda/visit_form.html b/project/npda/templates/npda/visit_form.html index 1ed6775f..6272b8bc 100644 --- a/project/npda/templates/npda/visit_form.html +++ b/project/npda/templates/npda/visit_form.html @@ -79,7 +79,8 @@ {% if field.field.category == field_category %}
- {% if field.id_for_label == 'id_height' or field.id_for_label == 'id_weight' %} + {% is_not_excluded_centile_field field as included_field %} + {% if included_field %} {% endif %}
@@ -99,25 +100,27 @@ {% else %} - {% if field.id_for_label == 'id_height' or field.id_for_label == 'id_weight' or field.id_for_label == 'id_bmi' %} + {% is_not_excluded_centile_field field as included_field %} + {% if included_field or field.id_for_label == 'id_bmi' %} - {% if field.id_for_label == 'id_bmi' %} - - {% else %} - - {% endif %} + {% if field.id_for_label == 'id_bmi' %} + + {% else %} + + {% endif %} - {% centile_sds field as centile_sds %} - {% with centile=centile_sds.0 sds=centile_sds.1 %} - {% if centile %} - - - - {% endif %} - - {% endwith %} + {% centile_sds field as centile_sds %} + {% with centile=centile_sds.0 sds=centile_sds.1 %} + {% if centile %} + + + + {% endif %} + + {% endwith %} - {% endif %} + {% endif %} + {% endif %} {% for error in field.errors %} diff --git a/project/npda/templatetags/npda_tags.py b/project/npda/templatetags/npda_tags.py index d8a3130a..b1909b2f 100644 --- a/project/npda/templatetags/npda_tags.py +++ b/project/npda/templatetags/npda_tags.py @@ -141,6 +141,22 @@ def centile_sds(field): return centile, sds +@register.simple_tag +def is_not_excluded_centile_field(field): + exclude = [ + "id_height_centile", + "id_height_sds", + "id_weight_centile", + "id_weight_sds", + "id_bmi_centile", + "id_bmi_sds", + "id_bmi", + ] + if field.id_for_label not in exclude: + return True + return False + + @register.filter def join_with_comma(value): if isinstance(value, list): From 88eff2a1f4986d28797c25778dd4fc2125f557ec Mon Sep 17 00:00:00 2001 From: eatyourpeas Date: Tue, 19 Nov 2024 17:30:59 +0000 Subject: [PATCH 2/2] template comment --- project/npda/templates/npda/visit_form.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/npda/templates/npda/visit_form.html b/project/npda/templates/npda/visit_form.html index 6272b8bc..9bf95ad0 100644 --- a/project/npda/templates/npda/visit_form.html +++ b/project/npda/templates/npda/visit_form.html @@ -99,7 +99,7 @@
{% else %} - + {% is_not_excluded_centile_field field as included_field %} {% if included_field or field.id_for_label == 'id_bmi' %}