Merge pull request #5032 from jumpserver/dev

fix(assets): 修复获取org_root的问题
pull/5041/head
Jiangjie.Bai 2020-11-18 11:29:53 +08:00 committed by GitHub
commit 177055acdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -352,7 +352,9 @@ class SomeNodesMixin:
@classmethod
def org_root(cls):
root = cls.objects.filter(parent_key='').exclude(key__startswith='-')
root = cls.objects.filter(parent_key='')\
.filter(key__regex=r'^[0-9]+$')\
.exclude(key__startswith='-')
if root:
return root[0]
else: