pagination
This commit is contained in:
parent
c87b145151
commit
381179579c
|
@ -115,8 +115,10 @@ USE_L10N = True
|
|||
USE_TZ = True
|
||||
|
||||
# 跨域配置
|
||||
CORS_ALLOW_CREDENTIALS = False
|
||||
CORS_ORIGIN_ALLOW_ALL = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/3.0/howto/static-files/
|
||||
|
||||
|
@ -146,8 +148,7 @@ REST_FRAMEWORK = {
|
|||
'rest_framework.filters.SearchFilter',
|
||||
'rest_framework.filters.OrderingFilter'
|
||||
],
|
||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||
'PAGE_SIZE': 10,
|
||||
'DEFAULT_PAGINATION_CLASS': 'utils.pagination.MyPagination',
|
||||
'DATETIME_FORMAT': '%Y-%m-%d %H:%M:%S',
|
||||
'DATE_FORMAT': '%Y-%m-%d',
|
||||
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
from rest_framework.pagination import PageNumberPagination
|
||||
|
||||
|
||||
class MyPagination(PageNumberPagination):
|
||||
page_size = 10
|
||||
page_size_query_param = 'limit'
|
Loading…
Reference in New Issue