def get_page(self, object_list):
        page_size = getattr(self, 'page_size', None)
        if page_size is None:
            return {
                'meta': {},
                'objects': object_list,
            }
        max_page_size = getattr(self, 'max_page_size', page_size)

        try:
            page_size = int(self.request.GET.get(self.LIMIT_PARAM, page_size))
        except ValueError:
            raise http.NotFound('Invalid page size')
        page_size = max(1, min(page_size, max_page_size))

        page_num = 0
        try:
            page_num = int(self.request.GET[self.PAGE_PARAM])
        except ValueError:
            # Bad page - default to 0
            pass
        except KeyError:
            try:
                offset = int(self.request.GET[self.OFFSET_PARAM])
            except (ValueError, KeyError):
                pass
            else:
                page_num = offset // page_size

        paginator = Paginator(object_list, page_size, allow_empty_first_page=True)
        try:
            page = paginator.page(page_num + 1)
        except EmptyPage:
            raise http.NotFound()
        return {
            'meta': {
                'offset': page.start_index() - 1,
                'page': page_num,
                'total_pages': paginator.num_pages,
                'limit': page_size,
                'count': paginator.count,
                'has_next': page.has_next(),
                'has_prev': page.has_previous(),
            },
            'objects': page.object_list,
        }

    # Response helpers
Return a paginated object list, along with some metadata
dataset/ETHPy150Open funkybob/django-nap/nap/rest/publisher.py/Publisher.get_page