Skip to content

Instantly share code, notes, and snippets.

@akshar-raaj
Created July 8, 2019 07:35
Show Gist options
  • Select an option

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

Select an option

Save akshar-raaj/2dc05386897518d4c13bcf14f936258d to your computer and use it in GitHub Desktop.
QuestionSerializer
class QuestionSerializer(serializers.ModelSerializer):
choice_set = ChoiceSerializer(many=True)
class Meta:
model = Question
fields = ('pub_date', 'question_text', 'choice_set')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment