Skip to content

Commit

Permalink
13
Browse files Browse the repository at this point in the history
  • Loading branch information
fabilya committed Oct 2, 2023
1 parent 7deba51 commit 5ca9d51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions backend/api/pagination.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from rest_framework.pagination import PageNumberPagination


class PageLimitPagination(PageNumberPagination):
page_size = 6
page_size_query_param = "limit"
2 changes: 1 addition & 1 deletion backend/foodgram/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
'DEFAULT_FILTER_BACKENDS': [
'django_filters.rest_framework.DjangoFilterBackend'
],
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'DEFAULT_PAGINATION_CLASS': 'api.pagination.PageLimitPagination',
'PAGE_SIZE': 6,
}

Expand Down

0 comments on commit 5ca9d51

Please sign in to comment.