Skip to content

Commit

Permalink
✨ [maykinmedia/commonground-api-common#33] add dynamic pagination to …
Browse files Browse the repository at this point in the history
…viewsets
  • Loading branch information
annashamray committed Sep 5, 2024
1 parent d5583bc commit b8a1729
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/openklant/components/contactgegevens/api/viewset.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from drf_spectacular.utils import extend_schema, extend_schema_view
from rest_framework import viewsets
from rest_framework.pagination import PageNumberPagination
from vng_api_common.pagination import DynamicPageSizePagination

from openklant.components.contactgegevens.api.serializers import (
OrganisatieSerializer,
Expand Down Expand Up @@ -44,7 +44,7 @@ class OrganisatieViewSet(viewsets.ModelViewSet):
queryset = Organisatie.objects.order_by("-pk")
serializer_class = OrganisatieSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
authentication_classes = (TokenAuthentication,)
permission_classes = (TokenPermissions,)

Expand Down Expand Up @@ -82,6 +82,6 @@ class PersoonViewSet(viewsets.ModelViewSet):
queryset = Persoon.objects.order_by("-pk")
serializer_class = PersoonSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
authentication_classes = (TokenAuthentication,)
permission_classes = (TokenPermissions,)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from drf_spectacular.utils import extend_schema, extend_schema_view
from rest_framework import viewsets
from rest_framework.pagination import PageNumberPagination
from vng_api_common.pagination import DynamicPageSizePagination

from openklant.components.klantinteracties.api.filterset.actoren import ActorenFilterSet
from openklant.components.klantinteracties.api.serializers.actoren import (
Expand Down Expand Up @@ -48,7 +48,7 @@ class ActorViewSet(viewsets.ModelViewSet):
)
serializer_class = ActorSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
filterset_class = ActorenFilterSet
authentication_classes = (TokenAuthentication,)
permission_classes = (TokenPermissions,)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from drf_spectacular.utils import extend_schema, extend_schema_view
from rest_framework import viewsets
from rest_framework.pagination import PageNumberPagination
from vng_api_common.pagination import DynamicPageSizePagination

from openklant.components.klantinteracties.api.filterset.digitaal_adres import (
DigitaalAdresDetailFilterSet,
Expand Down Expand Up @@ -54,7 +54,7 @@ class DigitaalAdresViewSet(ExpandMixin, viewsets.ModelViewSet):
)
serializer_class = DigitaalAdresSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
authentication_classes = (TokenAuthentication,)
permission_classes = (TokenPermissions,)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from drf_spectacular.utils import extend_schema, extend_schema_view
from rest_framework import viewsets
from rest_framework.pagination import PageNumberPagination
from vng_api_common.pagination import DynamicPageSizePagination

from openklant.components.klantinteracties.api.filterset.internetaken import (
InternetaakFilterSet,
Expand Down Expand Up @@ -50,7 +50,7 @@ class InterneTaakViewSet(viewsets.ModelViewSet):
)
serializer_class = InterneTaakSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
filterset_class = InternetaakFilterSet
authentication_classes = (TokenAuthentication,)
permission_classes = (TokenPermissions,)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django_filters.rest_framework import DjangoFilterBackend
from drf_spectacular.utils import extend_schema, extend_schema_view
from rest_framework import viewsets
from rest_framework.pagination import PageNumberPagination
from vng_api_common.pagination import DynamicPageSizePagination

from openklant.components.klantinteracties.api.filterset.klantcontacten import (
ActorKlantcontactFilterSet,
Expand Down Expand Up @@ -68,7 +68,7 @@ class KlantcontactViewSet(ExpandMixin, viewsets.ModelViewSet):
)
serializer_class = KlantcontactSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
authentication_classes = (TokenAuthentication,)
permission_classes = (TokenPermissions,)

Expand Down Expand Up @@ -127,7 +127,7 @@ class BetrokkeneViewSet(viewsets.ModelViewSet):
)
serializer_class = BetrokkeneSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
filterset_class = BetrokkeneFilterSet
authentication_classes = (TokenAuthentication,)
permission_classes = (TokenPermissions,)
Expand Down Expand Up @@ -167,7 +167,7 @@ class OnderwerpobjectViewSet(viewsets.ModelViewSet):
)
serializer_class = OnderwerpobjectSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
filter_backends = [DjangoFilterBackend]
filterset_fields = [
"onderwerpobjectidentificator_object_id",
Expand Down Expand Up @@ -210,7 +210,7 @@ class BijlageViewSet(viewsets.ModelViewSet):
queryset = Bijlage.objects.order_by("-pk").select_related("klantcontact")
serializer_class = BijlageSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
filter_backends = [DjangoFilterBackend]
filterset_fields = [
"bijlageidentificator_object_id",
Expand Down Expand Up @@ -258,7 +258,7 @@ class ActorKlantcontactViewSet(viewsets.ModelViewSet):
)
serializer_class = ActorKlantcontactSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
filterset_class = ActorKlantcontactFilterSet
authentication_classes = (TokenAuthentication,)
permission_classes = (TokenPermissions,)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django_filters.rest_framework import DjangoFilterBackend
from drf_spectacular.utils import extend_schema, extend_schema_view
from rest_framework import viewsets
from rest_framework.pagination import PageNumberPagination
from vng_api_common.pagination import DynamicPageSizePagination

from openklant.components.klantinteracties.api.filterset.partijen import (
CategorieRelatieFilterSet,
Expand Down Expand Up @@ -72,7 +72,7 @@ class PartijViewSet(ExpandMixin, viewsets.ModelViewSet):
)
serializer_class = PartijSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
authentication_classes = (TokenAuthentication,)
permission_classes = (TokenPermissions,)

Expand Down Expand Up @@ -122,7 +122,7 @@ class VertegenwoordigdenViewSet(viewsets.ModelViewSet):
)
serializer_class = VertegenwoordigdenSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
filterset_class = VertegenwoordigdenFilterSet
authentication_classes = (TokenAuthentication,)
permission_classes = (TokenPermissions,)
Expand Down Expand Up @@ -165,7 +165,7 @@ class CategorieRelatieViewSet(viewsets.ModelViewSet):
serializer_class = CategorieRelatieSerializer
lookup_field = "uuid"
filterset_class = CategorieRelatieFilterSet
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
authentication_classes = (TokenAuthentication,)
permission_classes = (TokenPermissions,)

Expand Down Expand Up @@ -203,7 +203,7 @@ class CategorieViewSet(viewsets.ModelViewSet):
queryset = Categorie.objects.order_by("-pk")
serializer_class = CategorieSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
authentication_classes = (TokenAuthentication,)
permission_classes = (TokenPermissions,)

Expand Down Expand Up @@ -241,7 +241,7 @@ class PartijIdentificatorViewSet(viewsets.ModelViewSet):
queryset = PartijIdentificator.objects.order_by("-pk").select_related("partij")
serializer_class = PartijIdentificatorSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
filter_backends = [DjangoFilterBackend]
filterset_fields = [
"andere_partij_identificator",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django_filters.rest_framework import DjangoFilterBackend
from drf_spectacular.utils import extend_schema, extend_schema_view
from rest_framework import viewsets
from rest_framework.pagination import PageNumberPagination
from vng_api_common.pagination import DynamicPageSizePagination

from openklant.components.klantinteracties.api.serializers.rekeningnummers import (
RekeningnummerSerializer,
Expand Down Expand Up @@ -44,7 +44,7 @@ class RekeningnummerViewSet(viewsets.ModelViewSet):
)
serializer_class = RekeningnummerSerializer
lookup_field = "uuid"
pagination_class = PageNumberPagination
pagination_class = DynamicPageSizePagination
filter_backends = [DjangoFilterBackend]
filterset_fields = [
"uuid",
Expand Down
2 changes: 1 addition & 1 deletion src/openklant/conf/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
REST_FRAMEWORK = BASE_REST_FRAMEWORK.copy()
REST_FRAMEWORK["PAGE_SIZE"] = 100
REST_FRAMEWORK["DEFAULT_PAGINATION_CLASS"] = (
"rest_framework.pagination.PageNumberPagination"
"vng_api_common.pagination.DynamicPageSizePagination"
)
REST_FRAMEWORK["DEFAULT_SCHEMA_CLASS"] = "openklant.components.utils.schema.AutoSchema"

Expand Down

0 comments on commit b8a1729

Please sign in to comment.