Skip to content

Instantly share code, notes, and snippets.

@ewelina29
Created April 10, 2021 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ewelina29/3c415961609a79fa185577a14e3b4fd6 to your computer and use it in GitHub Desktop.
Save ewelina29/3c415961609a79fa185577a14e3b4fd6 to your computer and use it in GitHub Desktop.
class PizzaListSerializer(serializers.ModelSerializer):
sauce = serializers.CharField(source="sauce.name")
class Meta:
model = Pizza
fields = '__all__'
depth = 1
class PizzaCreateSerializer(serializers.ModelSerializer):
class Meta:
model = Pizza
fields = '__all__'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment