Skip to content

Commit fc96326

Browse files
authored
Merge pull request #376 from MuckRock/375-page-size
Make max page size configurable
2 parents f99583e + 4cf880e commit fc96326

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

config/settings/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,9 @@
440440
AUTH_PAGE_LIMIT = env.int("AUTH_PAGE_LIMIT", default=1000)
441441
ANON_PAGE_LIMIT = env.int("ANON_PAGE_LIMIT", default=100)
442442

443+
DEFAULT_PAGE_SIZE = env.int("DEFAULT_PAGE_SIZE", default=25)
444+
MAX_PAGE_SIZE = env.int("MAX_PAGE_SIZE", default=1000)
445+
443446
# django-extensions
444447
# ------------------------------------------------------------------------------
445448
# https://django-extensions.readthedocs.io/en/latest/installation_instructions.html#configuration

documentcloud/core/pagination.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def paginate_queryset(self, queryset, request, view=None):
6868

6969
class CursorPagination(pagination.CursorPagination):
7070
ordering = "pk"
71-
page_size = 25
72-
max_page_size = 1000
71+
page_size = settings.DEFAULT_PAGE_SIZE
72+
max_page_size = settings.MAX_PAGE_SIZE
7373
page_size_query_param = "per_page"
7474

7575

local.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.8'
2-
31
volumes:
42
local_postgres15_data: {}
53
local_postgres15_data_backups: {}
@@ -8,7 +6,6 @@ volumes:
86
local_minio_data: {}
97

108
services:
11-
129
documentcloud_django: &django
1310
build:
1411
context: .
@@ -35,7 +32,6 @@ services:
3532
aliases:
3633
- internal.api.dev.documentcloud.org
3734

38-
3935
documentcloud_postgres:
4036
build:
4137
context: .

0 commit comments

Comments
 (0)