Last active
August 25, 2020 06:18
-
-
Save velotiotech/54e716e3c1fc1afb6e688291c89dafae to your computer and use it in GitHub Desktop.
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): | |
author = AuthorSerializer() | |
book_display_name= serializers.SerializerMethodField(source="get_book_display_name") | |
def get_book_display_name(self, book): | |
return book.name.upper() | |
class Meta: | |
model = Book | |
fields = "__all__" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment