Skip to content

Commit 2eb9107

Browse files
committed
Merge pull request #2798 from Boomerangz/depth-should-reduce
Depth should reduce on nested ModelSerializer classes.
2 parents 2394577 + 2d5b4f4 commit 2eb9107

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rest_framework/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ def build_nested_field(self, field_name, relation_info, nested_depth):
10381038
class NestedSerializer(ModelSerializer):
10391039
class Meta:
10401040
model = relation_info.related_model
1041-
depth = nested_depth
1041+
depth = nested_depth - 1
10421042

10431043
field_class = NestedSerializer
10441044
field_kwargs = get_nested_relation_kwargs(relation_info)

0 commit comments

Comments
 (0)