28 lines
650 B
Python
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()
|