Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created August 25, 2020 05:55
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 velotiotech/59196c2b39096272e105281dfafbb1c4 to your computer and use it in GitHub Desktop.
Save velotiotech/59196c2b39096272e105281dfafbb1c4 to your computer and use it in GitHub Desktop.
class AuthorSerializer(serializers.ModelSerializer):
class Meta:
model = Author
fields = "__all__"
class BookSerializer(serializers.ModelSerializer):
author = AuthorSerializer()
class Meta:
model = Book
fields = "__all__"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment