aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_pagination.py
diff options
context:
space:
mode:
authorTom Christie2014-09-02 17:41:23 +0100
committerTom Christie2014-09-02 17:41:23 +0100
commitf2852811f93863f2eed04d51eeb7ef27716b2409 (patch)
tree45799932849f81d45d77edc53cb00269465ba0f1 /tests/test_pagination.py
parentec096a1caceff6a4f5c75a152dd1c7bea9ed281d (diff)
downloaddjango-rest-framework-f2852811f93863f2eed04d51eeb7ef27716b2409.tar.bz2
Getting tests passing
Diffstat (limited to 'tests/test_pagination.py')
-rw-r--r--tests/test_pagination.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/test_pagination.py b/tests/test_pagination.py
index 8f9e0005..2e56d970 100644
--- a/tests/test_pagination.py
+++ b/tests/test_pagination.py
@@ -391,10 +391,10 @@ class CustomField(serializers.Field):
class BasicModelSerializer(serializers.Serializer):
text = CustomField()
- def __init__(self, *args, **kwargs):
- super(BasicModelSerializer, self).__init__(*args, **kwargs)
+ def to_native(self, value):
if 'view' not in self.context:
- raise RuntimeError("context isn't getting passed into serializer init")
+ raise RuntimeError("context isn't getting passed into serializer")
+ return super(BasicSerializer, self).to_native(value)
class TestContextPassedToCustomField(TestCase):
@@ -423,7 +423,7 @@ class LinksSerializer(serializers.Serializer):
class CustomPaginationSerializer(pagination.BasePaginationSerializer):
links = LinksSerializer(source='*') # Takes the page object as the source
- total_results = serializers.Field(source='paginator.count')
+ total_results = serializers.ReadOnlyField(source='paginator.count')
results_field = 'objects'