Created
May 7, 2019 11:02
-
-
Save akshar-raaj/44b7f1f4459c67e01e27aac4755f25e9 to your computer and use it in GitHub Desktop.
List and Detail Serializer
This file contains hidden or 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 QuestionListPageSerializer(serializers.ModelSerializer): | |
| was_published_recently = serializers.BooleanField(read_only=True) | |
| class Meta: | |
| model = Question | |
| fields = '__all__' | |
| class QuestionDetailPageSerializer(QuestionListPageSerializer): | |
| choices = ChoiceSerializer(read_only=True, many=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment