[Bugfix] 修复当终端设置包含多个命令存储时,访问 /docs/ 页面错误的问题

pull/3397/head
BaiJiangJie 5 years ago
parent db5ff0f922
commit c7ecfd7943

@ -53,6 +53,8 @@ class UserGrantedRemoteAppsAsTreeApi(UserGrantedRemoteAppsApi):
permission_classes = (IsOrgAdminOrAppUser,)
def get_serializer(self, remote_apps=None, *args, **kwargs):
if remote_apps is None:
remote_apps = []
only_remote_app = self.request.query_params.get('only', '0') == '1'
tree_root = None
data = []

@ -29,6 +29,9 @@ class CommandQueryMixin:
default_days_ago = 5
def get_queryset(self):
# 解决访问 /docs/ 问题
if hasattr(self, 'swagger_fake_view'):
return self.command_store.model.objects.none()
date_from, date_to = self.get_date_range()
q = self.request.query_params
multi_command_storage = get_multi_command_storage()

Loading…
Cancel
Save