功能变化(框架-分页器): 可全局自定义配置分页
parent
9121e7ad29
commit
89a0c66455
|
@ -283,7 +283,7 @@ REST_FRAMEWORK = {
|
|||
),
|
||||
|
||||
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.AutoSchema',
|
||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||
'DEFAULT_PAGINATION_CLASS': 'vadmin.op_drf.pagination.JsonPagination',
|
||||
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
|
||||
'EXCEPTION_HANDLER': 'apps.vadmin.utils.exceptions.op_exception_handler',
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class GenericAPIView(CustomAPIView):
|
|||
filter_backends = api_settings.DEFAULT_FILTER_BACKENDS
|
||||
|
||||
# The style to use for queryset pagination.
|
||||
pagination_class = Pagination
|
||||
pagination_class = api_settings.DEFAULT_PAGINATION_CLASS
|
||||
|
||||
def get_queryset(self):
|
||||
"""
|
||||
|
|
|
@ -29,7 +29,7 @@ def get_object_or_404(queryset, *filter_args, **filter_kwargs):
|
|||
|
||||
class GenericViewSet(ViewSetMixin, GenericAPIView):
|
||||
extra_filter_backends = []
|
||||
pagination_class = Pagination
|
||||
pagination_class = api_settings.DEFAULT_PAGINATION_CLASS
|
||||
filter_backends = [DjangoFilterBackend, OrderingFilter, SearchFilter, AdvancedSearchFilter]
|
||||
view_logger_classes = (CustomerModelViewLogger,)
|
||||
|
||||
|
|
Loading…
Reference in New Issue