#serializers.py

from rest_framework import serializers

from .models import Quiz, QuestionBlock

class QuestionSerializer(serializers.ModelSerializer):
    choices = serializers.StringRelatedField(many=True, read_only=True)

    class Meta:
        model = QuestionBlock
        fields = ('question', 'choices', 'correctChoice')


class QuizSerializer(serializers.ModelSerializer):
    questions = QuestionSerializer(many=True, read_only=True)

    class Meta:
        model = Quiz
        fields = ('title', 'questions')

2fe4252e7b133424388094263f607615aab4ba82
<mask token>


class QuizSerializer(serializers.ModelSerializer):
    questions = QuestionSerializer(many=True, read_only=True)


    class Meta:
        model = Quiz
        fields = 'title', 'questions'

<mask token>


class QuestionSerializer(serializers.ModelSerializer):
    <mask token>


    class Meta:
        model = QuestionBlock
        fields = 'question', 'choices', 'correctChoice'


class QuizSerializer(serializers.ModelSerializer):
    questions = QuestionSerializer(many=True, read_only=True)


    class Meta:
        model = Quiz
        fields = 'title', 'questions'

<mask token>


class QuestionSerializer(serializers.ModelSerializer):
    choices = serializers.StringRelatedField(many=True, read_only=True)


    class Meta:
        model = QuestionBlock
        fields = 'question', 'choices', 'correctChoice'


class QuizSerializer(serializers.ModelSerializer):
    questions = QuestionSerializer(many=True, read_only=True)


    class Meta:
        model = Quiz
        fields = 'title', 'questions'

from rest_framework import serializers
from .models import Quiz, QuestionBlock


class QuestionSerializer(serializers.ModelSerializer):
    choices = serializers.StringRelatedField(many=True, read_only=True)


    class Meta:
        model = QuestionBlock
        fields = 'question', 'choices', 'correctChoice'


class QuizSerializer(serializers.ModelSerializer):
    questions = QuestionSerializer(many=True, read_only=True)


    class Meta:
        model = Quiz
        fields = 'title', 'questions'

#serializers.py

from rest_framework import serializers

from .models import Quiz, QuestionBlock

class QuestionSerializer(serializers.ModelSerializer):
    choices = serializers.StringRelatedField(many=True, read_only=True)

    class Meta:
        model = QuestionBlock
        fields = ('question', 'choices', 'correctChoice')


class QuizSerializer(serializers.ModelSerializer):
    questions = QuestionSerializer(many=True, read_only=True)

    class Meta:
        model = Quiz
        fields = ('title', 'questions')
