From e429f702e00ed807d68e90cd6a6af2749eb0b73e Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 7 Jan 2013 20:17:52 +0000 Subject: [PATCH 1/5] Fix PAGINATE_BY_PARAM docs. Refs #551 --- docs/api-guide/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-guide/settings.md b/docs/api-guide/settings.md index 7884d096b..8c87f2ca5 100644 --- a/docs/api-guide/settings.md +++ b/docs/api-guide/settings.md @@ -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. From 4bb504732d045fb7db0fc1ddc1fc926197dd2c91 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 7 Jan 2013 21:08:55 +0000 Subject: [PATCH 2/5] Respect blank=True on relational fields. Fixes #537 --- rest_framework/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index fa92838b6..19a955b85 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 } From 31b585f26a8fc72e5b527b7672c7691e374dc494 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 7 Jan 2013 21:13:10 +0000 Subject: [PATCH 3/5] Note paginate_by=None usage. Fixes #555. --- docs/api-guide/pagination.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/api-guide/pagination.md b/docs/api-guide/pagination.md index ab335e6e2..71253afb0 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. --- From 4e8f55887d6ce86a2293f8b8cbb255bc58995336 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 7 Jan 2013 21:37:44 +0000 Subject: [PATCH 4/5] Clean up test slightly. Refs #552 --- rest_framework/tests/pagination.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_framework/tests/pagination.py b/rest_framework/tests/pagination.py index 81d297a1f..3b5508779 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): From 4df1172665f6df3d4c4df53b4836e2c6ed462da5 Mon Sep 17 00:00:00 2001 From: Marc Tamlyn Date: Tue, 8 Jan 2013 11:45:55 +0000 Subject: [PATCH 5/5] Fix reference to BasicAuthentication in settings. --- docs/api-guide/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-guide/settings.md b/docs/api-guide/settings.md index 8c87f2ca5..a422e5f61 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