2
There is no need for the get_included
method. Simply add the snippets
attribute to the class.
class UserSerializer(serializers.ModelSerializer):
included = SnippetSerializer(many=True, read_only=True)
class Meta:
model = User
depth = 1
fields = ('id','included')
Source:stackexchange.com