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
c931d317
Commit
c931d317
authored
Mar 24, 2017
by
右书僮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复资产组更新中 用户己选择的资产项不全问题
parent
c5666f13
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
asset_modal_list.html
apps/assets/templates/assets/asset_modal_list.html
+5
-5
views.py
apps/assets/views.py
+13
-3
No files found.
apps/assets/templates/assets/asset_modal_list.html
View file @
c931d317
...
...
@@ -18,7 +18,7 @@
</tr>
</thead>
<tbody>
{% for asset in asset
_modal_list
%}
{% for asset in asset
s
%}
{% if asset.id in all_assets %}
<tr
name=
"oAssets"
class=
"odd selected text-center"
>
<td
class=
"text-center"
><input
type=
"checkbox"
name=
"checked"
value=
"{{ asset.id }}"
checked=
"checked"
></td>
...
...
@@ -26,10 +26,10 @@
<tr
name=
"oAssets"
>
<td
class=
"text-center"
><input
type=
"checkbox"
name=
"checked"
value=
"{{ asset.id }}"
></td>
{% endif %}
<td>
{{ asset.id }}
</td>
<td>
{{ asset.hostname }}
</td>
<td>
{{ asset.ip }}
</td>
<td>
{{ asset.env }}-{{ asset.type }}
</td>
<td
class=
"text-center"
>
{{ asset.id }}
</td>
<td
class=
"text-center"
>
{{ asset.hostname }}
</td>
<td
class=
"text-center"
>
{{ asset.ip }}
</td>
<td
class=
"text-center"
>
{{ asset.env }}-{{ asset.type }}
</td>
</tr>
{% endfor %}
</tbody>
...
...
apps/assets/views.py
View file @
c931d317
...
...
@@ -195,6 +195,7 @@ class AssetModalListView(AdminUserRequiredMixin, ListView):
tag_id
=
self
.
request
.
GET
.
get
(
'tag_id'
)
plain_id_lists
=
self
.
request
.
GET
.
get
(
'plain_id_lists'
)
self
.
s
=
self
.
request
.
GET
.
get
(
'plain_id_lists'
)
assets
=
Asset
.
objects
.
all
()
if
","
in
str
(
self
.
s
):
self
.
plain_id_lists
=
[
int
(
x
)
for
x
in
self
.
s
.
split
(
','
)]
else
:
...
...
@@ -206,19 +207,28 @@ class AssetModalListView(AdminUserRequiredMixin, ListView):
else
:
plain_id_lists
=
[
int
(
self
.
s
)]
context
=
{
'all_assets'
:
plain_id_lists
'all_assets'
:
plain_id_lists
,
'assets'
:
assets
}
kwargs
.
update
(
context
)
if
group_id
:
group
=
AssetGroup
.
objects
.
get
(
id
=
group_id
)
print
group
context
=
{
'all_assets'
:
[
x
.
id
for
x
in
group
.
assets
.
all
()]
'all_assets'
:
[
x
.
id
for
x
in
group
.
assets
.
all
()],
'assets'
:
assets
}
kwargs
.
update
(
context
)
if
tag_id
:
tag
=
Tag
.
objects
.
get
(
id
=
tag_id
)
context
=
{
'all_assets'
:
[
x
.
id
for
x
in
tag
.
asset_set
.
all
()]
'all_assets'
:
[
x
.
id
for
x
in
tag
.
asset_set
.
all
()],
'assets'
:
assets
}
kwargs
.
update
(
context
)
else
:
context
=
{
'assets'
:
assets
}
kwargs
.
update
(
context
)
return
super
(
AssetModalListView
,
self
)
.
get_context_data
(
**
kwargs
)
...
...
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