Merge pull request #4391 from ansible/set_max_page_size

Set an upper limit of 200 on the max page size
This commit is contained in:
Matthew Jones 2016-12-12 14:51:29 -05:00 committed by GitHub
commit e83360592f
2 changed files with 3 additions and 0 deletions

View File

@ -2,6 +2,7 @@
# All Rights Reserved.
# Django REST Framework
from django.conf import settings
from rest_framework import pagination
from rest_framework.utils.urls import replace_query_param
@ -9,6 +10,7 @@ from rest_framework.utils.urls import replace_query_param
class Pagination(pagination.PageNumberPagination):
page_size_query_param = 'page_size'
max_page_size = settings.MAX_PAGE_SIZE
def get_next_link(self):
if not self.page.has_next():

View File

@ -223,6 +223,7 @@ INSTALLED_APPS = (
INTERNAL_IPS = ('127.0.0.1',)
MAX_PAGE_SIZE = 200
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'awx.api.pagination.Pagination',
'PAGE_SIZE': 25,