Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Cleanup on nutrition models and templates

Roland Geider9d9a89272061
diff --git a/nutrition/models.py b/nutrition/models.py
index da4eaed11..0c9ea2f95 100644
--- a/nutrition/models.py
+++ b/nutrition/models.py
@@ -82,12 +82,11 @@ class Ingredient(models.Model):
class Meta:
ordering = ["name", ]
+ language = models.ForeignKey(Language, verbose_name = _('Language'))
name = models.CharField(max_length=100,
verbose_name = _('Name'),)
- language = models.ForeignKey(Language, verbose_name = _('Language'))
-
energy = models.IntegerField(
verbose_name = _('Energy'),
help_text = _('In kcal per 100g'))
@@ -99,11 +98,19 @@ class Ingredient(models.Model):
carbohydrates = models.FloatField(
verbose_name = _('Carbohydrates'),
help_text = _('In g per 100g of product'))
+
+ carbohydrates_sugar = models.FloatField(
+ verbose_name = _('Sugar content in carbohydrates'),
+ help_text = _('In g per 100g of product'))
fat = models.FloatField(blank = True,
verbose_name = _('Fat'),
help_text = _('In g per 100g of product'))
+ fat_saturated = models.FloatField(
+ verbose_name = _('Saturated fat content in fats'),
+ help_text = _('In g per 100g of product'))
+
fibres = models.FloatField(blank = True,
null = True,
verbose_name = _('Fibres'),
diff --git a/nutrition/templates/edit_ingredient.html b/nutrition/templates/edit_ingredient.html
index 46c993158..383d93b1b 100644
--- a/nutrition/templates/edit_ingredient.html
+++ b/nutrition/templates/edit_ingredient.html
@@ -19,7 +19,9 @@
{% include "form_snippet.html" with field=form.energy %}
{% include "form_snippet.html" with field=form.protein %}
{% include "form_snippet.html" with field=form.carbohydrates %}
+ {% include "form_snippet.html" with field=form.carbohydrates_sugar %}
{% include "form_snippet.html" with field=form.fat %}
+ {% include "form_snippet.html" with field=form.fat_saturated %}
{% include "form_snippet.html" with field=form.fibres %}
{% include "form_snippet.html" with field=form.natrium %}
<tr>
diff --git a/nutrition/templates/view_ingredient.html b/nutrition/templates/view_ingredient.html
index 424e728ed..eb96fa4cf 100644
--- a/nutrition/templates/view_ingredient.html
+++ b/nutrition/templates/view_ingredient.html
@@ -26,14 +26,9 @@ $(document).ready(function() {
<table>
<thead>
<tr>
- <th>
+ <th colspan="2">
{% trans "Macronutrients" %}
</th>
- <th>
- <div class="editoptions">
-
- </div>
- </th>
</tr>
</thead>
<tbody>
@@ -49,24 +44,27 @@ $(document).ready(function() {
<td>{% trans "Carbohydrates" %}</td>
<td>{{ingredient.carbohydrates}} g</td>
</tr>
+ <tr>
+ <td style="padding-left: 3em;">{% trans "Sugar content in carbohydrates" %}</td>
+ <td>{{ingredient.carbohydrates_sugar}} g</td>
+ </tr>
<tr>
<td>{% trans "Fat" %}</td>
<td>{{ingredient.fat}} g</td>
</tr>
+ <tr>
+ <td style="padding-left: 3em;">{% trans "Saturated fat content in fats" %}</td>
+ <td>{{ingredient.fat_saturated}} g</td>
+ </tr>
</tbody>
</table>
<table>
<thead>
<tr>
- <th>
+ <th colspan="2">
{% trans "Others" %}
</th>
- <th>
- <div class="editoptions">
-
- </div>
- </th>
</tr>
</thead>
<tbody>