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
ab9744d5
Unverified
Commit
ab9744d5
authored
Jul 15, 2019
by
老广
Committed by
GitHub
Jul 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix (#2944)
* [Update] 修改assets * [Update] 修改nodes
parent
13ca70b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
asset.py
apps/assets/forms/asset.py
+3
-3
asset_permission.py
apps/perms/forms/asset_permission.py
+3
-2
No files found.
apps/assets/forms/asset.py
View file @
ab9744d5
...
@@ -29,9 +29,9 @@ class ProtocolForm(forms.Form):
...
@@ -29,9 +29,9 @@ class ProtocolForm(forms.Form):
class
AssetCreateForm
(
OrgModelForm
):
class
AssetCreateForm
(
OrgModelForm
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
super
()
.
__init__
(
*
args
,
**
kwargs
)
if
not
self
.
data
:
nodes_field
=
self
.
fields
[
'nodes'
]
nodes_field
=
self
.
fields
[
'nodes'
]
nodes_field
.
choices
=
((
n
.
id
,
n
.
full_value
)
for
n
in
nodes_field
.
_queryset
=
Node
.
get_queryset
(
)
Node
.
get_queryset
()
)
class
Meta
:
class
Meta
:
model
=
Asset
model
=
Asset
...
...
apps/perms/forms/asset_permission.py
View file @
ab9744d5
...
@@ -41,6 +41,9 @@ class AssetPermissionForm(OrgModelForm):
...
@@ -41,6 +41,9 @@ class AssetPermissionForm(OrgModelForm):
users_field
=
self
.
fields
.
get
(
'users'
)
users_field
=
self
.
fields
.
get
(
'users'
)
users_field
.
queryset
=
current_org
.
get_org_users
()
users_field
.
queryset
=
current_org
.
get_org_users
()
nodes_field
=
self
.
fields
[
'nodes'
]
nodes_field
.
choices
=
((
n
.
id
,
n
.
full_value
)
for
n
in
Node
.
get_queryset
())
# 前端渲染优化, 防止过多资产
# 前端渲染优化, 防止过多资产
if
not
self
.
data
:
if
not
self
.
data
:
instance
=
kwargs
.
get
(
'instance'
)
instance
=
kwargs
.
get
(
'instance'
)
...
@@ -49,8 +52,6 @@ class AssetPermissionForm(OrgModelForm):
...
@@ -49,8 +52,6 @@ class AssetPermissionForm(OrgModelForm):
assets_field
.
queryset
=
instance
.
assets
.
all
()
assets_field
.
queryset
=
instance
.
assets
.
all
()
else
:
else
:
assets_field
.
queryset
=
Asset
.
objects
.
none
()
assets_field
.
queryset
=
Asset
.
objects
.
none
()
nodes_field
=
self
.
fields
[
'nodes'
]
nodes_field
.
_queryset
=
Node
.
get_queryset
()
class
Meta
:
class
Meta
:
model
=
AssetPermission
model
=
AssetPermission
...
...
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