Browse Source

fix(perms): 用户搜索全部授权资产报错

pull/4716/head
xinwen 4 years ago committed by 老广
parent
commit
1d49b3deca
  1. 3
      apps/perms/api/user_permission/user_permission_assets.py

3
apps/perms/api/user_permission/user_permission_assets.py

@ -102,11 +102,12 @@ class UserAllGrantedAssetsApi(ListAPIView):
def get_queryset(self): def get_queryset(self):
queryset = get_user_granted_all_assets(self.user) queryset = get_user_granted_all_assets(self.user)
queryset = queryset.prefetch_related('platform')
return queryset.only(*self.only_fields) return queryset.only(*self.only_fields)
class MyAllAssetsAsTreeApi(ForUserMixin, AssetsAsTreeMixin, UserAllGrantedAssetsApi): class MyAllAssetsAsTreeApi(ForUserMixin, AssetsAsTreeMixin, UserAllGrantedAssetsApi):
pass search_fields = ['hostname', 'ip']
@method_decorator(tmp_to_root_org(), name='list') @method_decorator(tmp_to_root_org(), name='list')

Loading…
Cancel
Save