mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-21 19:38:07 +00:00
[Update] 修改swagger
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
from django.shortcuts import get_object_or_404
|
||||
from rest_framework.viewsets import ModelViewSet
|
||||
from rest_framework_bulk import BulkModelViewSet
|
||||
from common.mixins import IDInCacheFilterMixin
|
||||
from common.mixins import CommonApiMixin
|
||||
|
||||
from ..utils import set_to_root_org
|
||||
from ..models import Organization
|
||||
@@ -20,14 +20,16 @@ class RootOrgViewMixin:
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
class OrgModelViewSet(IDInCacheFilterMixin, ModelViewSet):
|
||||
class OrgModelViewSet(CommonApiMixin, ModelViewSet):
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().all()
|
||||
|
||||
|
||||
class OrgBulkModelViewSet(IDInCacheFilterMixin, BulkModelViewSet):
|
||||
class OrgBulkModelViewSet(CommonApiMixin, BulkModelViewSet):
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset().all()
|
||||
if hasattr(self, 'swagger_fake_view'):
|
||||
return queryset[:1]
|
||||
if hasattr(self, 'action') and self.action == 'list' and \
|
||||
hasattr(self, 'serializer_class') and \
|
||||
hasattr(self.serializer_class, 'setup_eager_loading'):
|
||||
|
Reference in New Issue
Block a user