aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/mixins.py
diff options
context:
space:
mode:
authorTom Christie2013-04-25 17:40:17 +0100
committerTom Christie2013-04-25 17:40:17 +0100
commit5d01ae661fcf85016718041e021b4bca524dfcdc (patch)
treee67623727f77dad57756532b018c710cdf03b032 /rest_framework/mixins.py
parent9abaf77401573e932ba4770248c1e229a8bc25dd (diff)
downloaddjango-rest-framework-5d01ae661fcf85016718041e021b4bca524dfcdc.tar.bz2
Simplify paginate_queryset method
Diffstat (limited to 'rest_framework/mixins.py')
-rw-r--r--rest_framework/mixins.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/rest_framework/mixins.py b/rest_framework/mixins.py
index 6e40b5c4..ec751e24 100644
--- a/rest_framework/mixins.py
+++ b/rest_framework/mixins.py
@@ -76,12 +76,9 @@ class ListModelMixin(object):
error_msg = self.empty_error % {'class_name': class_name}
raise Http404(error_msg)
- # Pagination size is set by the `.paginate_by` attribute,
- # which may be `None` to disable pagination.
- page_size = self.get_paginate_by()
- if page_size:
- packed = self.paginate_queryset(self.object_list, page_size)
- paginator, page, queryset, is_paginated = packed
+ # Switch between paginated or standard style responses
+ page = self.paginate_queryset(self.object_list)
+ if page is not None:
serializer = self.get_pagination_serializer(page)
else:
serializer = self.get_serializer(self.object_list, many=True)