aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Christie2013-01-08 15:05:34 +0000
committerTom Christie2013-01-08 15:05:34 +0000
commit37a84586871586cada799c232253641edbdb8400 (patch)
tree35275c8e15bedcb11fba1f3e6ae2f8eddc641d71
parentc1f194b0a592c88c7de512958f62c43695df018f (diff)
parentae139cb06f9dcd10d4d34ec3368d4910ae4c9c24 (diff)
downloaddjango-rest-framework-37a84586871586cada799c232253641edbdb8400.tar.bz2
Merge branch 'master' of https://github.com/tomchristie/django-rest-framework
-rw-r--r--docs/api-guide/pagination.md2
-rw-r--r--docs/api-guide/settings.md4
-rw-r--r--rest_framework/serializers.py2
-rw-r--r--rest_framework/tests/pagination.py4
4 files changed, 7 insertions, 5 deletions
diff --git a/docs/api-guide/pagination.md b/docs/api-guide/pagination.md
index ab335e6e..71253afb 100644
--- a/docs/api-guide/pagination.md
+++ b/docs/api-guide/pagination.md
@@ -97,6 +97,8 @@ You can also set the pagination style on a per-view basis, using the `ListAPIVie
paginate_by = 10
paginate_by_param = 'page_size'
+Note that using a `paginate_by` value of `None` will turn off pagination for the view.
+
For more complex requirements such as serialization that differs depending on the requested media type you can override the `.get_paginate_by()` and `.get_pagination_serializer_class()` methods.
---
diff --git a/docs/api-guide/settings.md b/docs/api-guide/settings.md
index 7884d096..a422e5f6 100644
--- a/docs/api-guide/settings.md
+++ b/docs/api-guide/settings.md
@@ -65,7 +65,7 @@ Default:
(
'rest_framework.authentication.SessionAuthentication',
- 'rest_framework.authentication.UserBasicAuthentication'
+ 'rest_framework.authentication.BasicAuthentication'
)
## DEFAULT_PERMISSION_CLASSES
@@ -106,7 +106,7 @@ The default page size to use for pagination. If set to `None`, pagination is di
Default: `None`
-## PAGINATE_BY_KWARG
+## PAGINATE_BY_PARAM
The name of a query parameter, which can be used by the client to overide the default page size to use for pagination. If set to `None`, clients may not override the default page size.
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py
index fa92838b..19a955b8 100644
--- a/rest_framework/serializers.py
+++ b/rest_framework/serializers.py
@@ -430,7 +430,7 @@ class ModelSerializer(Serializer):
# TODO: filter queryset using:
# .using(db).complex_filter(self.rel.limit_choices_to)
kwargs = {
- 'null': model_field.null,
+ 'null': model_field.null or model_field.blank,
'queryset': model_field.rel.to._default_manager
}
diff --git a/rest_framework/tests/pagination.py b/rest_framework/tests/pagination.py
index 81d297a1..3b550877 100644
--- a/rest_framework/tests/pagination.py
+++ b/rest_framework/tests/pagination.py
@@ -181,10 +181,10 @@ class UnitTestPagination(TestCase):
"""
Ensure context gets passed through to the object serializer.
"""
- serializer = PassOnContextPaginationSerializer(self.first_page)
+ serializer = PassOnContextPaginationSerializer(self.first_page, context={'foo': 'bar'})
serializer.data
results = serializer.fields[serializer.results_field]
- self.assertTrue(serializer.context is results.context)
+ self.assertEquals(serializer.context, results.context)
class TestUnpaginated(TestCase):