diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index ed709d848b..6f89df0db9 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -1112,7 +1112,7 @@ def _get_nested_class(self, nested_depth, relation_info): class NestedSerializer(ModelSerializer): class Meta: model = relation_info.related - depth = nested_depth + depth = nested_depth - 1 return NestedSerializer @@ -1139,6 +1139,6 @@ def _get_nested_class(self, nested_depth, relation_info): class NestedSerializer(HyperlinkedModelSerializer): class Meta: model = relation_info.related - depth = nested_depth + depth = nested_depth - 1 return NestedSerializer