Permalink
Browse files

Retain docstrings explaining pagination requirements.

  • Loading branch information...
1 parent 2860057 commit 86c9346a17003fb06b041df1a24d1c11633c6369 @markotibold markotibold committed Nov 12, 2012
Showing with 4 additions and 11 deletions.
  1. +4 −0 fiber/rest_api/serializers.py
  2. +0 −11 fiber/rest_api/views.py
@@ -48,5 +48,9 @@ class Meta:
class FiberPaginationSerializer(pagination.BasePaginationSerializer):
+ """
+ Simple-data-grid expects a total_pages key for a paginated view.
+ Simple-data-grid expects rows as the key for objects.
+ """
total_pages = serializers.Field(source='paginator.num_pages')
results_field = 'rows'
@@ -143,18 +143,7 @@ def check_fields(self, order_by):
if order_by not in self.orderable_fields:
raise ErrorResponse(status=HTTP_400_BAD_REQUEST, content="Can not order by the passed value.")
- def serialize_page_info(self, page):
- """
- simple-data-grid expects a total_pages key for a paginated view.
- """
- return {
- 'total_pages': page.paginator.num_pages,
- }
-
def filter_response(self, obj):
- """
- simple-data-grid expects rows instead of results (the Django REST framework default)
- """
obj = super(PaginatedListView, self).filter_response(obj)
if self.request.method.upper() == 'GET':
obj['rows'] = obj['results']

0 comments on commit 86c9346

Please sign in to comment.