API: Allow to set a custom pagination size

This commit is contained in:
Raphael Michel
2021-07-13 18:19:41 +02:00
parent ac16d9d900
commit 75dc80eb09
3 changed files with 9 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
from rest_framework.pagination import PageNumberPagination
class Pagination(PageNumberPagination):
page_size_query_param = 'page_size'
max_page_size = 50

View File

@@ -393,7 +393,7 @@ REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': [
'pretix.api.auth.permission.EventPermission',
],
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'DEFAULT_PAGINATION_CLASS': 'pretix.api.pagination.Pagination',
'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.NamespaceVersioning',
'PAGE_SIZE': 50,
'DEFAULT_AUTHENTICATION_CLASSES': (