mirror of https://github.com/jumpserver/jumpserver
perf: allow some api page no limits
parent
bd1d73c6dd
commit
b9c60d856f
|
@ -16,6 +16,7 @@ class CategoryViewSet(ListModelMixin, JMSGenericViewSet):
|
|||
'types': TypeSerializer,
|
||||
}
|
||||
permission_classes = (IsValidUser,)
|
||||
default_limit = None
|
||||
|
||||
def get_queryset(self):
|
||||
return AllTypes.categories()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue