Skip to content

Commit

Permalink
Use the same serializer for images for the nutrition info endpoint
Browse files Browse the repository at this point in the history
The ingredient_id was missing and causing problems on the flutter app

Closes github.com/wger-project/flutter/issues/558
  • Loading branch information
rolandgeider committed Apr 25, 2024
1 parent d64912d commit b8aa9bc
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions wger/nutrition/api/serializers.py
Expand Up @@ -104,31 +104,6 @@ class Meta:
]


class IngredientInfoImageSerializer(serializers.ModelSerializer):
"""
Image serializer
"""

class Meta:
model = Image
fields = [
'id',
'uuid',
'image',
'created',
'last_update',
'size',
'width',
'height',
'license',
'license_title',
'license_object_url',
'license_author',
'license_author_url',
'license_derivative_source_url',
]


class IngredientSerializer(serializers.ModelSerializer):
"""
Ingredient serializer
Expand Down Expand Up @@ -167,7 +142,7 @@ class IngredientInfoSerializer(serializers.ModelSerializer):
"""

weight_units = IngredientWeightUnitInfoSerializer(source='ingredientweightunit_set', many=True)
image = IngredientInfoImageSerializer(read_only=True)
image = IngredientImageSerializer(read_only=True)

class Meta:
model = Ingredient
Expand Down

0 comments on commit b8aa9bc

Please sign in to comment.