Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

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

Select an option

Save akshar-raaj/d04e058aa8f35da9660d1cfe76c643ff to your computer and use it in GitHub Desktop.
ChoiceSerializerWithVotes and QuestionResultPageSerializer
class ChoiceSerializerWithVotes(ChoiceSerializer):
class Meta(ChoiceSerializer.Meta):
fields = ChoiceSerializer.Meta.fields + ('votes',)
class QuestionResultPageSerializer(QuestionListPageSerializer):
choices = ChoiceSerializerWithVotes(many=True, read_only=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment