Commit a6825ac9 authored by Webb's avatar Webb

fixed asset_list html and asset_update

parent 8ee9d02f
......@@ -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 %}
......@@ -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):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment