Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Output the weight unit as a primary key as well

Roland Geidere39c202cc7fc
diff --git a/wger/core/templatetags/wger_extras.py b/wger/core/templatetags/wger_extras.py
index 1a5a28371..d2e7cb0b9 100644
--- a/wger/core/templatetags/wger_extras.py
+++ b/wger/core/templatetags/wger_extras.py
@@ -22,8 +22,8 @@ from django.templatetags.static import static
from django.utils.html import strip_spaces_between_tags
from django.utils.safestring import mark_safe
from django.utils.translation import (
- pgettext,
- gettext_lazy as _
+ gettext_lazy as _,
+ pgettext
)
# wger
diff --git a/wger/nutrition/api/serializers.py b/wger/nutrition/api/serializers.py
index f91963f25..f05f6d9c5 100644
--- a/wger/nutrition/api/serializers.py
+++ b/wger/nutrition/api/serializers.py
@@ -160,15 +160,18 @@ class MealItemInfoSerializer(serializers.ModelSerializer):
meal = serializers.PrimaryKeyRelatedField(read_only=True)
ingredient = serializers.PrimaryKeyRelatedField(read_only=True)
ingredient_obj = IngredientInfoSerializer(source='ingredient', read_only=True)
+ weight_unit = serializers.PrimaryKeyRelatedField(read_only=True)
+ weight_unit_obj = IngredientWeightUnitSerializer(source='weight_unit', read_only=True)
class Meta:
model = MealItem
depth = 1
fields = ['id',
'meal',
- 'ingredient_obj',
'ingredient',
+ 'ingredient_obj',
'weight_unit',
+ 'weight_unit_obj',
'order',
'amount']