From 799d11c0ed09f536c7741968f6d2f1a2b5bfd2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Br=C3=BCck?= Date: Thu, 30 May 2024 11:55:28 +1000 Subject: [PATCH] #481 hide figures if no value available --- bakeup/templates/workshop/product_detail.html | 10 +++++----- bakeup/workshop/templatetags/workshop_tags.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bakeup/templates/workshop/product_detail.html b/bakeup/templates/workshop/product_detail.html index 7d60a9e..ac343e0 100644 --- a/bakeup/templates/workshop/product_detail.html +++ b/bakeup/templates/workshop/product_detail.html @@ -77,11 +77,11 @@
Kennzahlen
- {% if key_figures_form.dough_yield %}{% bootstrap_field key_figures_form.dough_yield size='sm' addon_before='TA' wrapper_class='' layout='horizontal' horizontal_label_class='col-6' horizontal_field_class='col-4' %}{% endif %} - {% if key_figures_form.salt %}{% bootstrap_field key_figures_form.salt size='sm' addon_after='%' wrapper_class='' layout='horizontal' horizontal_label_class='col-6' horizontal_field_class='col-4' %}{% endif %} - {% if key_figures_form.total_dough_weight %}{% bootstrap_field key_figures_form.total_dough_weight size='sm' addon_after='g' wrapper_class='' layout='horizontal' horizontal_label_class='col-6' horizontal_field_class='col-4' %}{% endif %} - {% if key_figures_form.wheat %}{% bootstrap_field key_figures_form.wheat size='sm' wrapper_class='resize-none' layout='horizontal' horizontal_label_class='col-6' horizontal_field_class='col-6' %}{% endif %} - {% if key_figures_form.pre_ferment %}{% bootstrap_field key_figures_form.pre_ferment size='sm' addon_after='%' wrapper_class='' layout='horizontal' horizontal_label_class='col-6' horizontal_field_class='col-4' %}{% endif %} + {% if key_figures_form.dough_yield and key_figures_form.dough_yield.value %}{% bootstrap_field key_figures_form.dough_yield size='sm' addon_before='TA' wrapper_class='' layout='horizontal' horizontal_label_class='col-6' horizontal_field_class='col-4' %}{% endif %} + {% if key_figures_form.salt and key_figures_form.salt.value %}{% bootstrap_field key_figures_form.salt size='sm' addon_after='%' wrapper_class='' layout='horizontal' horizontal_label_class='col-6' horizontal_field_class='col-4' %}{% endif %} + {% if key_figures_form.total_dough_weight and key_figures_form.total_dough_weight.value %}{% bootstrap_field key_figures_form.total_dough_weight size='sm' addon_after='g' wrapper_class='' layout='horizontal' horizontal_label_class='col-6' horizontal_field_class='col-4' %}{% endif %} + {% if key_figures_form.wheat and key_figures_form.wheat.value %}{% bootstrap_field key_figures_form.wheat size='sm' wrapper_class='resize-none' layout='horizontal' horizontal_label_class='col-6' horizontal_field_class='col-6' %}{% endif %} + {% if key_figures_form.pre_ferment and key_figures_form.pre_ferment.value %}{% bootstrap_field key_figures_form.pre_ferment size='sm' addon_after='%' wrapper_class='' layout='horizontal' horizontal_label_class='col-6' horizontal_field_class='col-4' %}{% endif %} {% endif %} diff --git a/bakeup/workshop/templatetags/workshop_tags.py b/bakeup/workshop/templatetags/workshop_tags.py index 2818363..4cbd11e 100644 --- a/bakeup/workshop/templatetags/workshop_tags.py +++ b/bakeup/workshop/templatetags/workshop_tags.py @@ -15,7 +15,7 @@ def baker_percentage(weight, flour_weight): @register.filter def clever_rounding(value): - if not value: + if value is None: return None if float(value) < 100: return floatformat(round(value, 1), -1)