2👍
✅
Assuming you defined your custom create() and update() functions on your serializer.
class ASerializer(serializers.ModelSerializer):
question_type = serializers.ReadOnlyField(source='template.question_type', read_only=True)
question = serializers.ReadOnlyField(source='template.question', read_only=True)
answer_type = serializers.ReadOnlyField(source='template.answer_type', read_only=True)
available_choices = serializers.ReadOnlyField(source='template.available_choices', read_only=True)
class Meta:
model = A
Source:stackexchange.com