Skip to content

Commit

Permalink
Merge pull request #191 from monzo/larger-page-users
Browse files Browse the repository at this point in the history
Increase the default page size for users to 500 by default
  • Loading branch information
Chris authored Nov 18, 2019
2 parents c226113 + 1e5890a commit dfe4268
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions response/core/util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import bleach
import bleach_whitelist
from django.conf import settings
from rest_framework.pagination import PageNumberPagination


def sanitize(string):
Expand All @@ -14,3 +15,9 @@ def sanitize(string):
)

return string


class LargeResultsSetPagination(PageNumberPagination):
page_size = 500
max_page_size = 1000
page_size_query_param = "page_size"
3 changes: 3 additions & 0 deletions response/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
from response.core.models.incident import Incident
from response.core.models.timeline import TimelineEvent
from response.core.models.user_external import ExternalUser
from response.core.util import LargeResultsSetPagination


class ExternalUserViewSet(viewsets.ReadOnlyModelViewSet):
queryset = ExternalUser.objects.all()
serializer_class = serializers.ExternalUserSerializer
# Set page size to 1000
pagination_class = LargeResultsSetPagination


class ActionViewSet(viewsets.ModelViewSet):
Expand Down

0 comments on commit dfe4268

Please sign in to comment.