forked from aboutcode-org/purldb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_custom.py
More file actions
23 lines (19 loc) · 782 Bytes
/
api_custom.py
File metadata and controls
23 lines (19 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# purldb is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/aboutcode-org/purldb for support or download.
# See https://aboutcode.org for more information about nexB OSS projects.
#
from rest_framework.pagination import PageNumberPagination
class PageSizePagination(PageNumberPagination):
"""
Adds the page_size parameter. Default results per page is 10.
A page_size parameter can be provided, limited to 20 results per page max.
For example:
http://api.example.org/accounts/?page=4&page_size=20
"""
page_size = 20
max_page_size = 20
page_size_query_param = "page_size"