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
a6825ac9
Commit
a6825ac9
authored
Feb 25, 2017
by
Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed asset_list html and asset_update
parent
8ee9d02f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
20 deletions
+24
-20
asset_list.html
apps/assets/templates/assets/asset_list.html
+5
-1
views.py
apps/assets/views.py
+19
-19
No files found.
apps/assets/templates/assets/asset_list.html
View file @
a6825ac9
...
...
@@ -218,8 +218,11 @@ $(document).ready(function(){
var
name
=
$
(
this
).
closest
(
"tr"
).
find
(
":nth-child(2)"
).
children
(
'a'
).
html
();
var
uid
=
$this
.
data
(
'uid'
);
var
the_url
=
'{% url "api-assets:asset-detail" pk=99991937 %}'
.
replace
(
'99991937'
,
uid
);
console
.
log
(
the_url
);
objDelete
(
$this
,
name
,
the_url
);
$data_table
.
ajax
.
reload
();
setTimeout
(
function
()
{
$data_table
.
ajax
.
reload
();
},
3000
);
})
.
on
(
'click'
,
'#btn_bulk_update'
,
function
()
{
...
...
@@ -355,5 +358,6 @@ $(document).ready(function(){
{
#
APIUpdateAttr
({
url
:
the_url
,
method
:
'PATCH'
,
body
:
JSON
.
stringify
(
post_list
),
success
:
success
});
#
}
$
(
'#asset_bulk_update_modal'
).
modal
(
'hide'
);
});
</script>
{% endblock %}
apps/assets/views.py
View file @
a6825ac9
...
...
@@ -139,25 +139,25 @@ class AssetUpdateView(AdminUserRequiredMixin, UpdateAssetTagsMiXin, UpdateView):
print
(
form
.
errors
)
return
super
(
AssetUpdateView
,
self
)
.
form_invalid
(
form
)
def
form_valid
(
self
,
form
):
asset
=
form
.
save
(
commit
=
False
)
def
prn_obj_key
(
obj_form
):
return
obj_form
.
clean
()
.
keys
()
for
i
in
prn_obj_key
(
form
):
if
i
not
in
self
.
new_form
.
keys
():
print
i
#delattr(asset, '"%s" % i')
#del asset.i
asset
.
save
()
asset
.
id
=
27
# asset.created_by = self.request.user.username or 'Admin'
asset
.
save
()
asset
.
id
=
28
asset
.
save
()
return
super
(
AssetUpdateView
,
self
)
.
form_valid
(
form
)
#
def form_valid(self, form):
#
asset = form.save(commit=False)
#
#
def prn_obj_key(obj_form):
#
return obj_form.clean().keys()
#
#
for i in prn_obj_key(form):
#
if i not in self.new_form.keys():
#
print i
#
#
#delattr(asset, '"%s" % i')
#
#del asset.i
#
asset.save()
#
asset.id = 27
#
# asset.created_by = self.request.user.username or 'Admin'
#
asset.save()
#
asset.id = 28
#
asset.save()
#
return super(AssetUpdateView, self).form_valid(form)
class
AssetDeleteView
(
DeleteView
):
...
...
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