fixed asset_list html and asset_update

pull/530/head
Webb 2017-02-25 17:25:27 +08:00
parent 8ee9d02ffc
commit a6825ac91e
2 changed files with 24 additions and 20 deletions

View File

@ -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 %}

View File

@ -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):