[Fixed]-Django Restful: Nested Serializers

1👍

in your SampleSerializer. You have specified ‘tests‘ which is not in your Sample class in your model…

Use nested SerializerMethodField as below….

tests = serializers.SerializerMethodField()

def get_tests(self, obj):

    var=TestRequestSerializer(obj.id)
     return var.data
👤Amrit

Leave a comment