lty/qy_lty/common/pagination.py
2026-03-17 13:17:02 +08:00

9 lines
408 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from rest_framework.pagination import PageNumberPagination
class CustomPageNumberPagination(PageNumberPagination):
"""
自定义分页类允许客户端通过page_size参数指定每页显示的数量
"""
page_size = 10 # 默认每页显示数量
page_size_query_param = 'page_size' # 指定每页数量的查询参数名
max_page_size = 100 # 每页最大显示数量