class QuestionSerializer(serializers.Serializer):
    id = serializers.CharField()
question_text = QuestionTextSerializer()
topic = TopicSerializer()


class TopicQuestionSerializer(QuestionSerializer):
    topic = TopicSerializer()
Dynamically exclude or include a field in Django REST framework serializer