mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
Improve the get_queryset
overriding test readability.
This commit is contained in:
parent
98fc7caad8
commit
6d95da7b2d
|
@ -177,9 +177,11 @@ class TestSlugRelatedField(APISimpleTestCase):
|
|||
assert representation == self.instance.name
|
||||
|
||||
def test_no_queryset_init(self):
|
||||
qs = self.queryset
|
||||
|
||||
class NoQuerySetSlugRelatedField(serializers.SlugRelatedField):
|
||||
def get_queryset(this):
|
||||
return self.queryset
|
||||
def get_queryset(self):
|
||||
return qs
|
||||
|
||||
field = NoQuerySetSlugRelatedField(slug_field='name')
|
||||
field.to_internal_value(self.instance.name)
|
||||
|
|
Loading…
Reference in New Issue
Block a user