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