You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
from rest_framework.pagination import PageNumberPagination
|
|
|
|
from rest_framework import status
|
|
|
|
from common.myresponse import MyResponse
|
|
|
|
|
|
|
|
|
|
|
|
class MyPagination(PageNumberPagination):
|
|
|
|
page_size = 2
|
|
|
|
max_page_size = 5
|
|
|
|
page_size_query_param = 'size'
|
|
|
|
page_query_param = 'page'
|
|
|
|
|
|
|
|
def get_paginated_response(self, data):
|
|
|
|
return MyResponse(data=data, code=200, msg='OK', status=status.HTTP_200_OK, count=self.page.paginator.count,
|
|
|
|
next=self.get_next_link(), previous=self.get_previous_link())
|