diff --git a/apps/assets/api/category.py b/apps/assets/api/category.py index 242840716..abc2b12e6 100644 --- a/apps/assets/api/category.py +++ b/apps/assets/api/category.py @@ -16,6 +16,7 @@ class CategoryViewSet(ListModelMixin, JMSGenericViewSet): 'types': TypeSerializer, } permission_classes = (IsValidUser,) + default_limit = None def get_queryset(self): return AllTypes.categories() diff --git a/apps/assets/api/platform.py b/apps/assets/api/platform.py index 3828803bf..c5a21f4ed 100644 --- a/apps/assets/api/platform.py +++ b/apps/assets/api/platform.py @@ -43,6 +43,7 @@ class AssetPlatformViewSet(JMSModelViewSet): 'ops_methods': 'assets.view_platform', 'filter_nodes_assets': 'assets.view_platform', } + default_limit = None def get_queryset(self): # 因为没有走分页逻辑,所以需要这里 prefetch diff --git a/apps/jumpserver/rewriting/pagination.py b/apps/jumpserver/rewriting/pagination.py index 9a5fd263d..3a6ae48f1 100644 --- a/apps/jumpserver/rewriting/pagination.py +++ b/apps/jumpserver/rewriting/pagination.py @@ -17,4 +17,9 @@ class MaxLimitOffsetPagination(LimitOffsetPagination): self.max_limit = view.page_max_limit if view and hasattr(view, 'page_default_limit'): self.default_limit = view.page_default_limit + + if view and hasattr(view, 'default_limit'): + self.default_limit = view.default_limit + return super().paginate_queryset(queryset, request, view) +