initial commit
This commit is contained in:
commit
c6961c03c3
33 changed files with 1782 additions and 0 deletions
17
stratoflights_api/custom_pagination.py
Normal file
17
stratoflights_api/custom_pagination.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from rest_framework.pagination import LimitOffsetPagination
|
||||
from rest_framework.response import Response
|
||||
|
||||
class CustomLimitOffsetPagination(LimitOffsetPagination):
|
||||
limit_query_param = 'limit'
|
||||
offset_query_param = 'skip'
|
||||
max_limit = 100
|
||||
default_limit = 10
|
||||
|
||||
|
||||
def get_paginated_response(self, data):
|
||||
return Response({
|
||||
'total': self.count,
|
||||
'limit': self.limit,
|
||||
'skip': self.offset,
|
||||
'predictions': data
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue