mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 16:03:21 +00:00
20 lines
715 B
Python
20 lines
715 B
Python
from rest_framework.pagination import PageNumberPagination
|
|
|
|
from N3wtSchool import settings
|
|
|
|
class CustomProfilesPagination(PageNumberPagination):
|
|
page_size_query_param = 'page_size'
|
|
max_page_size = settings.NB_MAX_PAGE
|
|
page_size = settings.NB_RESULT_PROFILES_PER_PAGE
|
|
|
|
def get_paginated_response(self, data):
|
|
return ({
|
|
'links': {
|
|
'next': self.get_next_link(),
|
|
'previous': self.get_previous_link()
|
|
},
|
|
'count': self.page.paginator.count,
|
|
'page_size': self.page_size,
|
|
'max_page_size' : self.max_page_size,
|
|
'profilesRoles': data }
|
|
) |