mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Paginate the job_tasks page.
This commit adds pagination to the /api/v1/jobs/{id}/job_tasks/ page,
which previously lacked it.
AC-1340
This commit is contained in:
parent
2f1d667e64
commit
ba7c33eaa2
@ -23,14 +23,14 @@ def paginated(method):
|
||||
# Manually spin up pagination.
|
||||
# How many results do we show?
|
||||
limit = api_settings.PAGINATE_BY
|
||||
if request.GET.get(api_settings.PAGINATE_BY_PARAM, False):
|
||||
limit = request.GET[api_settings.PAGINATE_BY_PARAM]
|
||||
if request.QUERY_PARAMS.get(api_settings.PAGINATE_BY_PARAM, False):
|
||||
limit = request.QUERY_PARAMS[api_settings.PAGINATE_BY_PARAM]
|
||||
if api_settings.MAX_PAGINATE_BY:
|
||||
limit = min(api_settings.MAX_PAGINATE_BY, limit)
|
||||
limit = int(limit)
|
||||
|
||||
# What page are we on?
|
||||
page = int(request.GET.get('page', 1))
|
||||
page = int(request.QUERY_PARAMS.get('page', 1))
|
||||
offset = (page - 1) * limit
|
||||
|
||||
# Add the limit, offset, and page variables to the keyword arguments
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user