Ingredient SerializersΒΆ
The ingredient serializer is a basic model serializer that relies on much of the rest framework magic to minimize the
amount of extra code required. The only additional fields on the serializer are amount
and measurement
, which
each contain a source
argument pointing to the get_FIELD_display
autogenerated function. This allows the
serializer to look up the formatted version of the choice fields.
-
class
recipes.serializers.ingredient.
IngredientSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs) Bases:
rest_framework.serializers.ModelSerializer
This serializer allows direct serialization for ingredient objects, with additional keys for choice fields
-
class
Meta
-
fields
= '__all__'
-
model
alias of
recipes.models.ingredient.Ingredient
-
-
class