Self hosted FLOSS fitness/workout, nutrition and weight tracker
Add the nutritional values of the current diet plan to the overview
Roland Geider4be4ec940eb7
diff --git a/manager/templates/index.html b/manager/templates/index.htmlindex 5ca098f62..c41c66bd5 100644--- a/manager/templates/index.html+++ b/manager/templates/index.html@@ -59,7 +59,22 @@{% trans "Nutrition plan" %}{% endif %}</a>- <br> – {{ plan.creation_date }}+ <br> – {{ plan.creation_date }}++ <ul>+ <li>+ {% trans "Energy" %}: {{nutritional_info.energy}} kcal+ </li>+ <li>+ {% trans "Protein" %}: {{nutritional_info.protein}} g+ </li>+ <li>+ {% trans "Carbohydrates" %}: {{nutritional_info.carbohydrates}} g+ </li>+ <li>+ {% trans "Fat" %}: {{nutritional_info.fat}} g+ </li>+ </ul>{% else %}<div class="box warning">diff --git a/manager/views.py b/manager/views.pyindex 632c36ad3..39f2a72d1 100644--- a/manager/views.py+++ b/manager/views.py@@ -75,6 +75,9 @@ def index(request):plan = NutritionPlan.objects.filter(user = request.user).latest('creation_date')template_data['plan'] = plan+ template_data['nutritional_info'] = plan.get_nutritional_values()++try:weight = WeightEntry.objects.filter(user = request.user).latest('creation_date')except ObjectDoesNotExist: