Skip to content

Commit

Permalink
Ref #207 - Add pagination using REST framework for the eventposts wit…
Browse files Browse the repository at this point in the history
…h activity stream added

- Create new class for EventPost pagination and register it as pagination_class
  • Loading branch information
Kerem Zaman committed Dec 10, 2021
1 parent 8f1cda6 commit 000c506
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions backend/eventposts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
from rest_framework import status
from rest_framework.response import Response
from rest_framework import viewsets
from rest_framework.pagination import PageNumberPagination


class EventPostsPagination(PageNumberPagination):
page_size = 10
page_size_query_param = 'page_size'
max_page_size = 1000

class EventViewSet(viewsets.ModelViewSet):
pagination_class = EventPostsPagination
queryset = EventPost.objects.all()
serializer_class = EventSerializer
JWTauth = JWTAuthentication()
Expand Down

0 comments on commit 000c506

Please sign in to comment.