fixed asset_group delete html

pull/530/head
Webb 8 years ago
parent a6825ac91e
commit 63fd3cfff2

@ -37,13 +37,13 @@ class AssetCreateForm(forms.ModelForm):
self.instance.tags.clear() self.instance.tags.clear()
self.instance.tags.add(*tuple(tags)) self.instance.tags.add(*tuple(tags))
def clean(self): # def clean(self):
clean_data = super(AssetCreateForm, self).clean() # clean_data = super(AssetCreateForm, self).clean()
ip = clean_data.get('ip') # ip = clean_data.get('ip')
port = clean_data.get('port') # port = clean_data.get('port')
query = Asset.objects.filter(ip=ip, port=port) # query = Asset.objects.filter(ip=ip, port=port)
if query: # if query:
raise forms.ValidationError('this asset has exists.') # raise forms.ValidationError('this asset has exists.')
class Meta: class Meta:
model = Asset model = Asset

@ -70,7 +70,9 @@ $(document).ready(function(){
var uid = $this.data('uid'); var uid = $this.data('uid');
var the_url = '{% url "api-assets:asset-group-detail" pk=99991937 %}'.replace('99991937', uid); var the_url = '{% url "api-assets:asset-group-detail" pk=99991937 %}'.replace('99991937', uid);
objectDelete($this, name, the_url); objectDelete($this, name, the_url);
$data_table.ajax.reload(); setTimeout( function () {
$data_table.ajax.reload();
}, 3000);
}) })
.on('click', '#btn_bulk_update', function () { .on('click', '#btn_bulk_update', function () {

@ -148,16 +148,16 @@ class AssetUpdateView(AdminUserRequiredMixin, UpdateAssetTagsMiXin, UpdateView):
# 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):

Loading…
Cancel
Save