Skip to content

Commit

Permalink
Merge pull request #965 from ita-social-projects/#964-BEUpdatePaginat…
Browse files Browse the repository at this point in the history
…ionFunctionality

#964 [BE] Update pagination functionality
  • Loading branch information
Lvyshnevska authored Nov 24, 2024
2 parents c0aaa10 + 44e1120 commit baa5182
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions BackEnd/forum/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ class ForumPagination(PageNumberPagination):
page_size_query_param = "page_size"
max_page_size = 64

def get_page_number(self, request, paginator):
page_number = super().get_page_number(request, paginator)
if int(page_number) > paginator.num_pages:
page_number = paginator.num_pages or 1
return page_number

def get_paginated_response(self, data):
return Response(
{
Expand Down

0 comments on commit baa5182

Please sign in to comment.