mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 00:04:16 +03:00
Fix broken depth argument
This commit is contained in:
parent
02c1b5988b
commit
21468a1867
|
@ -388,7 +388,10 @@ class ModelSerializer(Serializer):
|
||||||
"""
|
"""
|
||||||
Creates a default instance of a nested relational field.
|
Creates a default instance of a nested relational field.
|
||||||
"""
|
"""
|
||||||
return ModelSerializer()
|
class NestedModelSerializer(ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = model_field.rel.to
|
||||||
|
return NestedModelSerializer()
|
||||||
|
|
||||||
def get_related_field(self, model_field, to_many=False):
|
def get_related_field(self, model_field, to_many=False):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -136,6 +136,7 @@ class PrimaryKeyManyToManyTests(TestCase):
|
||||||
]
|
]
|
||||||
self.assertEquals(serializer.data, expected)
|
self.assertEquals(serializer.data, expected)
|
||||||
|
|
||||||
|
|
||||||
class PrimaryKeyForeignKeyTests(TestCase):
|
class PrimaryKeyForeignKeyTests(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
target = ForeignKeyTarget(name='target-1')
|
target = ForeignKeyTarget(name='target-1')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user