Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save akshar-raaj/44b7f1f4459c67e01e27aac4755f25e9 to your computer and use it in GitHub Desktop.

Select an option

Save akshar-raaj/44b7f1f4459c67e01e27aac4755f25e9 to your computer and use it in GitHub Desktop.
List and Detail Serializer
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