fix ranvher invetory entry bug for existence of rancher - set pagination message
This commit is contained in:
@@ -1,7 +1,21 @@
|
||||
from rest_framework.pagination import PageNumberPagination
|
||||
from rest_framework.response import Response
|
||||
|
||||
|
||||
class CustomPageNumberPagination(PageNumberPagination):
|
||||
page_size = 20 # default
|
||||
page_size_query_param = 'page_size' # set from client
|
||||
max_page_size = 100 # maximum items to show
|
||||
message = None
|
||||
|
||||
def get_paginated_response(self, data):
|
||||
return Response({
|
||||
'message': self.message, # Custom message
|
||||
'count': self.page.paginator.count,
|
||||
'next': self.get_next_link(),
|
||||
'previous': self.get_previous_link(),
|
||||
'results': data
|
||||
})
|
||||
|
||||
def set_message(self, message):
|
||||
self.message = message
|
||||
|
||||
Reference in New Issue
Block a user