diff --git a/project/npda/templates/npda/visit_form.html b/project/npda/templates/npda/visit_form.html index 1ed6775f..9bf95ad0 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 %}
@@ -98,26 +99,28 @@
{% 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):