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
6f570bcb
Commit
6f570bcb
authored
Jul 04, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 修改Node无法被删除的bug
parent
bab4326a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
node.py
apps/assets/models/node.py
+13
-1
settings.py
apps/jumpserver/settings.py
+4
-4
No files found.
apps/assets/models/node.py
View file @
6f570bcb
...
...
@@ -9,13 +9,18 @@ from django.utils.translation import ugettext_lazy as _
from
django.utils.translation
import
ugettext
from
django.core.cache
import
cache
from
orgs.mixins
import
OrgModelMixin
from
orgs.mixins
import
OrgModelMixin
,
OrgManager
from
orgs.utils
import
set_current_org
,
get_current_org
from
orgs.models
import
Organization
__all__
=
[
'Node'
]
class
NodeQuerySet
(
models
.
QuerySet
):
def
delete
(
self
):
raise
PermissionError
(
"Bulk delete node deny"
)
class
FamilyMixin
:
_parents
=
None
_children
=
None
...
...
@@ -242,6 +247,7 @@ class Node(OrgModelMixin, FamilyMixin, FullValueMixin, AssetsAmountMixin):
child_mark
=
models
.
IntegerField
(
default
=
0
)
date_create
=
models
.
DateTimeField
(
auto_now_add
=
True
)
objects
=
OrgManager
.
from_queryset
(
NodeQuerySet
)()
is_node
=
True
_parents
=
None
...
...
@@ -391,6 +397,7 @@ class Node(OrgModelMixin, FamilyMixin, FullValueMixin, AssetsAmountMixin):
"name"
:
self
.
name
,
"value"
:
self
.
value
,
"key"
:
self
.
key
,
"assets_amount"
:
self
.
assets_amount
,
},
'type'
:
'node'
}
...
...
@@ -398,6 +405,11 @@ class Node(OrgModelMixin, FamilyMixin, FullValueMixin, AssetsAmountMixin):
tree_node
=
TreeNode
(
**
data
)
return
tree_node
def
delete
(
self
,
using
=
None
,
keep_parents
=
False
):
if
self
.
children
or
self
.
assets
.
get_assets
():
return
return
super
()
.
delete
(
using
=
using
,
keep_parents
=
keep_parents
)
@classmethod
def
get_queryset
(
cls
):
from
..utils
import
NodeUtil
...
...
apps/jumpserver/settings.py
View file @
6f570bcb
...
...
@@ -301,10 +301,10 @@ LOGGING = {
'handlers'
:
[
'gunicorn_console'
,
'gunicorn_file'
],
'level'
:
'INFO'
,
},
'django.db'
:
{
'handlers'
:
[
'console'
,
'file'
],
'level'
:
'DEBUG'
}
#
'django.db': {
#
'handlers': ['console', 'file'],
#
'level': 'DEBUG'
#
}
}
}
...
...
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