mirror of https://github.com/jumpserver/jumpserver
fix: Node ordering [`parent_key`, `value`]; 修复默认组织Default节点显示问题(存在key为0的Default节点)
parent
af40e46a75
commit
89ec6ba6ef
|
@ -354,7 +354,8 @@ class SomeNodesMixin:
|
|||
def org_root(cls):
|
||||
root = cls.objects.filter(parent_key='')\
|
||||
.filter(key__regex=r'^[0-9]+$')\
|
||||
.exclude(key__startswith='-')
|
||||
.exclude(key__startswith='-')\
|
||||
.order_by('key')
|
||||
if root:
|
||||
return root[0]
|
||||
else:
|
||||
|
@ -411,7 +412,7 @@ class Node(OrgModelMixin, SomeNodesMixin, FamilyMixin, NodeAssetsMixin):
|
|||
|
||||
class Meta:
|
||||
verbose_name = _("Node")
|
||||
ordering = ['value']
|
||||
ordering = ['parent_key', 'value']
|
||||
|
||||
def __str__(self):
|
||||
return self.full_value
|
||||
|
|
Loading…
Reference in New Issue