perf: allow some api page no limits

pull/15947/head
ibuler 2025-08-28 15:17:04 +08:00 committed by 老广
parent bd1d73c6dd
commit b9c60d856f
3 changed files with 7 additions and 0 deletions

View File

@ -16,6 +16,7 @@ class CategoryViewSet(ListModelMixin, JMSGenericViewSet):
'types': TypeSerializer,
}
permission_classes = (IsValidUser,)
default_limit = None
def get_queryset(self):
return AllTypes.categories()

View File

@ -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

View File

@ -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)