Skip to content

Commit

Permalink
depth should reduce by one on each nesting level. Closes #2287.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchristie committed Dec 19, 2014
1 parent e0096fe commit 80bacc5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rest_framework/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

0 comments on commit 80bacc5

Please sign in to comment.