SOITA/questions/serializers.py
Hubert Jankowski 7c18f0920a WIP
2021-12-12 11:35:35 +01:00

28 lines
650 B
Python

from rest_framework import serializers
from questions.models import Question
from answers.serializers import AnswerSerializer
class QuestionSerializer(serializers.ModelSerializer):
# answers = serializers.SerializerMethodField()
#
# def get_answers(self, instance: Question):
# return instance.get_answers_secret()
answers = AnswerSerializer(many=True, required=False)
class Meta:
model = Question
fields = (
"id",
"name",
"description",
"answers",
"test"
)
def create(self, validated_data):
import pdb;pdb.set_trace()