Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
l y
Jumpserver
Commits
fedb650c
Commit
fedb650c
authored
4 years ago
by
Bai
Committed by
老广
4 years ago
Browse files
Options
Download
Email Patches
Plain Diff
fix: Node ordering [`parent_key`, `value`]; 修复默认组织Default节点显示问题(存在key为0的Default节点)
parent
a99cda7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/assets/models/node.py
+3
-2
apps/assets/models/node.py
with
3 additions
and
2 deletions
+3
-2
apps/assets/models/node.py
+
3
-
2
View file @
fedb650c
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment