Last active
February 8, 2017 15:39
-
-
Save filipeximenes/d2ff754dc21a1bc598f9 to your computer and use it in GitHub Desktop.
Expanded serializer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BookSerializer(serializers.ModelSerializer): | |
class Meta: | |
model = Book | |
fields = ['title', 'author'] | |
class ExpandedBookMixin(object) | |
books = BookSerializer(many=True) | |
class UserSerializer(serializers.ModelSerializer): | |
class Meta: | |
model = User | |
fields = ['first_name', 'books'] | |
class ExpandedUserSerializer(BookSerializer, UserSerializer): | |
pass | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The http://instagram.com/stickynikki86