Skip to content

Commit 80bacc5

Browse files
committed
depth should reduce by one on each nesting level. Closes #2287.
1 parent e0096fe commit 80bacc5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rest_framework/serializers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ def _get_nested_class(self, nested_depth, relation_info):
11121112
class NestedSerializer(ModelSerializer):
11131113
class Meta:
11141114
model = relation_info.related
1115-
depth = nested_depth
1115+
depth = nested_depth - 1
11161116

11171117
return NestedSerializer
11181118

@@ -1139,6 +1139,6 @@ def _get_nested_class(self, nested_depth, relation_info):
11391139
class NestedSerializer(HyperlinkedModelSerializer):
11401140
class Meta:
11411141
model = relation_info.related
1142-
depth = nested_depth
1142+
depth = nested_depth - 1
11431143

11441144
return NestedSerializer

0 commit comments

Comments
 (0)