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
1877511a
Commit
1877511a
authored
Aug 14, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 更改组织同事更改节点名称
parent
1c5ce61e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
hands.py
apps/orgs/hands.py
+4
-0
signals_handler.py
apps/orgs/signals_handler.py
+11
-1
No files found.
apps/orgs/hands.py
0 → 100644
View file @
1877511a
# -*- coding: utf-8 -*-
#
from
assets.models
import
Node
from
orgs.utils
import
set_current_org
,
current_org
apps/orgs/signals_handler.py
View file @
1877511a
...
...
@@ -5,9 +5,19 @@ from django.db.models.signals import post_save
from
django.dispatch
import
receiver
from
.models
import
Organization
from
.hands
import
set_current_org
,
current_org
,
Node
@receiver
(
post_save
,
sender
=
Organization
)
def
on_org_update
(
sender
,
instance
=
None
,
created
=
False
,
**
kwargs
):
def
on_org_create_or_update
(
sender
,
instance
=
None
,
created
=
False
,
**
kwargs
):
if
instance
:
old_org
=
current_org
set_current_org
(
instance
)
node_root
=
Node
.
root
()
if
node_root
.
value
!=
instance
.
name
:
node_root
.
value
=
instance
.
name
node_root
.
save
()
set_current_org
(
old_org
)
if
instance
and
not
created
:
instance
.
expire_cache
()
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