Skip to content

Commit c07543d

Browse files
committed
Configure pagination globally
1 parent adcf5b3 commit c07543d

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

junction/proposals/api.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
from rest_framework import generics
2-
from rest_framework.pagination import PageNumberPagination
32

43
from junction.base.constants import ProposalStatus
54
from junction.proposals import serializers
65
from junction.proposals.models import Proposal
76

87

9-
class StandardResultsSetPagination(PageNumberPagination):
10-
page_size = 2
11-
page_size_query_param = 'page'
12-
13-
148
class ProposalListApiView(generics.ListAPIView):
159

1610
serializer_class = serializers.ProposalListSerializer
17-
pagination_class = StandardResultsSetPagination
1811

1912
def get_queryset(self):
2013
queryset = Proposal.objects.filter(deleted=False, status=ProposalStatus.PUBLIC)

settings/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@
230230
CONN_MAX_AGE = 300
231231

232232
REST_FRAMEWORK = {
233-
'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',)
233+
'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',),
234+
'PAGE_SIZE': 20,
234235
}
235236

236237
EXPLARA_API_TOKEN = "shjbalkfbdskjlbdskljbdskaljfb"

0 commit comments

Comments
 (0)