Commit a6825ac9 authored by Webb's avatar Webb

fixed asset_list html and asset_update

parent 8ee9d02f
...@@ -218,8 +218,11 @@ $(document).ready(function(){ ...@@ -218,8 +218,11 @@ $(document).ready(function(){
var name = $(this).closest("tr").find(":nth-child(2)").children('a').html(); var name = $(this).closest("tr").find(":nth-child(2)").children('a').html();
var uid = $this.data('uid'); var uid = $this.data('uid');
var the_url = '{% url "api-assets:asset-detail" pk=99991937 %}'.replace('99991937', uid); var the_url = '{% url "api-assets:asset-detail" pk=99991937 %}'.replace('99991937', uid);
console.log(the_url);
objDelete($this, name, the_url); objDelete($this, name, the_url);
setTimeout( function () {
$data_table.ajax.reload(); $data_table.ajax.reload();
}, 3000);
}) })
.on('click', '#btn_bulk_update', function () { .on('click', '#btn_bulk_update', function () {
...@@ -355,5 +358,6 @@ $(document).ready(function(){ ...@@ -355,5 +358,6 @@ $(document).ready(function(){
{# APIUpdateAttr({url: the_url, method: 'PATCH', body: JSON.stringify(post_list), success: success});#} {# APIUpdateAttr({url: the_url, method: 'PATCH', body: JSON.stringify(post_list), success: success});#}
$('#asset_bulk_update_modal').modal('hide'); $('#asset_bulk_update_modal').modal('hide');
}); });
</script> </script>
{% endblock %} {% endblock %}
...@@ -139,25 +139,25 @@ class AssetUpdateView(AdminUserRequiredMixin, UpdateAssetTagsMiXin, UpdateView): ...@@ -139,25 +139,25 @@ class AssetUpdateView(AdminUserRequiredMixin, UpdateAssetTagsMiXin, UpdateView):
print(form.errors) print(form.errors)
return super(AssetUpdateView, self).form_invalid(form) return super(AssetUpdateView, self).form_invalid(form)
def form_valid(self, form): # def form_valid(self, form):
asset = form.save(commit=False) # asset = form.save(commit=False)
#
def prn_obj_key(obj_form): # def prn_obj_key(obj_form):
return obj_form.clean().keys() # return obj_form.clean().keys()
#
for i in prn_obj_key(form): # for i in prn_obj_key(form):
if i not in self.new_form.keys(): # if i not in self.new_form.keys():
print i # print i
#
#delattr(asset, '"%s" % i') # #delattr(asset, '"%s" % i')
#del asset.i # #del asset.i
asset.save() # asset.save()
asset.id = 27 # asset.id = 27
# asset.created_by = self.request.user.username or 'Admin' # # asset.created_by = self.request.user.username or 'Admin'
asset.save() # asset.save()
asset.id = 28 # asset.id = 28
asset.save() # asset.save()
return super(AssetUpdateView, self).form_valid(form) # return super(AssetUpdateView, self).form_valid(form)
class AssetDeleteView(DeleteView): 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