From 19e2e506fa70afdc3b87cdded9e94d920629e3ad Mon Sep 17 00:00:00 2001 From: Neal Striegler-Pettersson Date: Wed, 15 Feb 2023 09:36:17 -0500 Subject: [PATCH] Get paginator limit from url params When profiling requests with a huge number of queries sometimes we end up with multiple pages. This will allow the user to specify a page size via URL params. --- silk/utils/pagination.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/silk/utils/pagination.py b/silk/utils/pagination.py index 9a1a046d..69cd845a 100644 --- a/silk/utils/pagination.py +++ b/silk/utils/pagination.py @@ -4,7 +4,8 @@ def _page(request, query_set): - paginator = Paginator(query_set, 200) + per_page = request.GET.get('per_page', 200) + paginator = Paginator(query_set, per_page) page_number = request.GET.get('page') try: page = paginator.page(page_number)