diff --git a/uhepp_org/requirements.txt b/uhepp_org/requirements.txt index bdacb8808b9bc1b8a59979e6b96ae50c2358c15b..f969b6bebe6ab0a3cadb6ae84a69a2acd1950bb3 100644 --- a/uhepp_org/requirements.txt +++ b/uhepp_org/requirements.txt @@ -6,3 +6,4 @@ django-inline-svg psycopg2 django-crispy-forms jsonschema +djangorestframework-link-header-pagination diff --git a/uhepp_org/uhepp_api/views.py b/uhepp_org/uhepp_api/views.py index 9e96349a2bc29ff279e31d0fb394f1beebe9a0a8..5b2c2444f1398b6803588e3fbc98e056752de439 100644 --- a/uhepp_org/uhepp_api/views.py +++ b/uhepp_org/uhepp_api/views.py @@ -7,6 +7,7 @@ from rest_framework import generics, viewsets, status from rest_framework.response import Response from rest_framework.reverse import reverse from rest_framework.decorators import api_view, permission_classes +from drf_link_header_pagination import LinkHeaderPagination from uhepp_vault.models import PUBLIC_LEVEL, INTERNAL_LEVEL, PUBLIC_LEVEL, \ Collection, Plot @@ -124,8 +125,13 @@ class OwnModelViewSet: # Related-objects operations: # - Queryset filtering for related items in output, form choice +class PlotPagination(LinkHeaderPagination): + page_size = 100 + + class PlotViewSet(viewsets.ModelViewSet): permission_classes = [IsCollectionOwnerOrReadOnly] + pagination_class = PlotPagination def create(self, request, *args, **kwds): serializer = self.get_serializer(data=request.data)