Improve the get_queryset overriding test readability.

This commit is contained in:
Xavier Ordoquy 2016-01-21 16:48:32 +01:00
parent 98fc7caad8
commit 6d95da7b2d

View File

@ -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)