forked from CGM_Public/pretix_original
API: Allow to set a custom pagination size
This commit is contained in:
@@ -87,7 +87,8 @@ respectively, or ``null`` if there is no such page. You can use those URLs to re
|
|||||||
respective page.
|
respective page.
|
||||||
|
|
||||||
The field ``results`` contains a list of objects representing the first results. For most
|
The field ``results`` contains a list of objects representing the first results. For most
|
||||||
objects, every page contains 50 results.
|
objects, every page contains 50 results. You can specify a lower pagination size using the
|
||||||
|
``page_size`` query parameter, but no more than 50.
|
||||||
|
|
||||||
Conditional fetching
|
Conditional fetching
|
||||||
--------------------
|
--------------------
|
||||||
|
|||||||
6
src/pretix/api/pagination.py
Normal file
6
src/pretix/api/pagination.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from rest_framework.pagination import PageNumberPagination
|
||||||
|
|
||||||
|
|
||||||
|
class Pagination(PageNumberPagination):
|
||||||
|
page_size_query_param = 'page_size'
|
||||||
|
max_page_size = 50
|
||||||
@@ -393,7 +393,7 @@ REST_FRAMEWORK = {
|
|||||||
'DEFAULT_PERMISSION_CLASSES': [
|
'DEFAULT_PERMISSION_CLASSES': [
|
||||||
'pretix.api.auth.permission.EventPermission',
|
'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',
|
'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.NamespaceVersioning',
|
||||||
'PAGE_SIZE': 50,
|
'PAGE_SIZE': 50,
|
||||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
|||||||
Reference in New Issue
Block a user