Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
2c18a27e
Commit
2c18a27e
authored
Oct 16, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改节点创建规则
parent
910dd4e5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
3 deletions
+4
-3
asset.py
apps/assets/models/asset.py
+2
-1
node.py
apps/assets/models/node.py
+2
-1
mixins.py
apps/orgs/mixins.py
+0
-1
No files found.
apps/assets/models/asset.py
View file @
2c18a27e
...
...
@@ -34,7 +34,8 @@ def default_cluster():
def
default_node
():
try
:
from
.node
import
Node
return
Node
.
root
()
root
=
Node
.
root
()
return
root
except
:
return
None
...
...
apps/assets/models/node.py
View file @
2c18a27e
...
...
@@ -211,7 +211,8 @@ class Node(OrgModelMixin):
set_current_org
(
Organization
.
root
())
org_nodes_roots
=
cls
.
objects
.
filter
(
key__regex
=
r'^[0-9]+$'
)
org_nodes_roots_keys
=
org_nodes_roots
.
values_list
(
'key'
,
flat
=
True
)
or
[
'1'
]
key
=
str
(
max
([
int
(
k
)
for
k
in
org_nodes_roots_keys
])
+
1
)
key
=
max
([
int
(
k
)
for
k
in
org_nodes_roots_keys
])
key
=
str
(
key
+
1
)
if
key
!=
0
else
'2'
set_current_org
(
_current_org
)
root
=
cls
.
objects
.
create
(
key
=
key
,
value
=
_current_org
.
name
)
return
root
...
...
apps/orgs/mixins.py
View file @
2c18a27e
...
...
@@ -4,7 +4,6 @@
from
werkzeug.local
import
Local
from
django.db
import
models
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.db.models
import
Q
from
django.shortcuts
import
redirect
from
django.forms
import
ModelForm
from
django.http.response
import
HttpResponseForbidden
...
...
Write
Preview
Markdown
is supported
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