diff --git a/.gitignore b/.gitignore
index 8b29c0db4..9f5ded8b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,5 @@ config.py
migrations/
*.log
host_rsa_key
+*.bat
+tags
diff --git a/apps/assets/forms.py b/apps/assets/forms.py
index eea3c23dd..c8f846f15 100644
--- a/apps/assets/forms.py
+++ b/apps/assets/forms.py
@@ -20,13 +20,13 @@ class AssetCreateForm(forms.ModelForm):
self.instance.tags.clear()
self.instance.tags.add(*tuple(tags))
- def clean(self):
- clean_data = super(AssetCreateForm, self).clean()
- ip = clean_data.get('ip')
- port = clean_data.get('port')
- query = Asset.objects.filter(ip=ip, port=port)
- if query:
- raise forms.ValidationError('this asset has exists.')
+ # def clean(self):
+ # clean_data = super(AssetCreateForm, self).clean()
+ # ip = clean_data.get('ip')
+ # port = clean_data.get('port')
+ # query = Asset.objects.filter(ip=ip, port=port)
+ # if query:
+ # raise forms.ValidationError('this asset has exists.')
class Meta:
model = Asset
diff --git a/apps/assets/templates/assets/_asset_bulk_update_modal.html b/apps/assets/templates/assets/_asset_bulk_update_modal.html
index 391fc5361..9ff3d2973 100644
--- a/apps/assets/templates/assets/_asset_bulk_update_modal.html
+++ b/apps/assets/templates/assets/_asset_bulk_update_modal.html
@@ -77,10 +77,6 @@
-
-
-
-
{% endblock %}
{% block modal_confirm_id %}btn_asset_bulk_update{% endblock %}
\ No newline at end of file
diff --git a/apps/assets/templates/assets/admin_user_detail.html b/apps/assets/templates/assets/admin_user_detail.html
index cfc7bc852..2d4cd53ef 100644
--- a/apps/assets/templates/assets/admin_user_detail.html
+++ b/apps/assets/templates/assets/admin_user_detail.html
@@ -1,6 +1,4 @@
{% extends 'base.html' %}
-{% load common_tags %}
-{% load users_tags %}
{% load static %}
{% load i18n %}
@@ -439,4 +437,4 @@ $(document).ready(function () {
objectDelete($this, name, the_url, redirect_url);
})
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/apps/assets/templates/assets/admin_user_list.html b/apps/assets/templates/assets/admin_user_list.html
index 44cd1bf06..73539ff5e 100644
--- a/apps/assets/templates/assets/admin_user_list.html
+++ b/apps/assets/templates/assets/admin_user_list.html
@@ -52,10 +52,11 @@ $(document).ready(function(){
$(td).html('' + innerHtml + '');
}},
{targets: 6, createdCell: function (td, cellData, rowData) {
- var script_btn = '{% trans "Script" %}'.replace('99991937', cellData);
+{# var script_btn = '{% trans "Script" %}'.replace('99991937', cellData);#}
var update_btn = '{% trans "Update" %}'.replace('99991937', cellData);
var del_btn = '{% trans "Delete" %}'.replace('99991937', cellData);
- $(td).html(script_btn + update_btn + del_btn)
+{# $(td).html(script_btn + update_btn + del_btn)#}
+ $(td).html(update_btn + del_btn)
}}],
ajax_url: '{% url "api-assets:admin-user-list" %}',
columns: [{data: function(){return ""}}, {data: "name" }, {data: "username" }, {data: "assets_amount" }, {data: function () {return 'lost'} },
@@ -72,7 +73,9 @@ $(document).ready(function(){
var uid = $this.data('uid');
var the_url = '{% url "api-assets:admin-user-detail" pk=99991937 %}'.replace('99991937', uid);
objectDelete($this, name, the_url);
- $data_table.ajax.reload();
+ setTimeout( function () {
+ $data_table.ajax.reload();
+ }, 3000);
})
.on('click', '#btn_bulk_update', function () {
diff --git a/apps/assets/templates/assets/asset_detail.html b/apps/assets/templates/assets/asset_detail.html
index 3a1975a9a..f52c50dc0 100644
--- a/apps/assets/templates/assets/asset_detail.html
+++ b/apps/assets/templates/assets/asset_detail.html
@@ -1,5 +1,4 @@
{% extends 'base.html' %}
-{% load common_tags %}
{% load static %}
{% load i18n %}
diff --git a/apps/assets/templates/assets/asset_group_detail.html b/apps/assets/templates/assets/asset_group_detail.html
index 6b1b2da6d..2dc09ab41 100644
--- a/apps/assets/templates/assets/asset_group_detail.html
+++ b/apps/assets/templates/assets/asset_group_detail.html
@@ -1,6 +1,4 @@
{% extends 'base.html' %}
-{% load common_tags %}
-{% load users_tags %}
{% load static %}
{% load i18n %}
@@ -394,4 +392,4 @@ $(document).ready(function () {
})
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/apps/assets/templates/assets/asset_group_list.html b/apps/assets/templates/assets/asset_group_list.html
index 1c11ea383..cfa893c31 100644
--- a/apps/assets/templates/assets/asset_group_list.html
+++ b/apps/assets/templates/assets/asset_group_list.html
@@ -70,7 +70,9 @@ $(document).ready(function(){
var uid = $this.data('uid');
var the_url = '{% url "api-assets:asset-group-detail" pk=99991937 %}'.replace('99991937', uid);
objectDelete($this, name, the_url);
- $data_table.ajax.reload();
+ setTimeout( function () {
+ $data_table.ajax.reload();
+ }, 3000);
})
.on('click', '#btn_bulk_update', function () {
diff --git a/apps/assets/templates/assets/asset_list.html b/apps/assets/templates/assets/asset_list.html
index 1ee934363..d12462cab 100644
--- a/apps/assets/templates/assets/asset_list.html
+++ b/apps/assets/templates/assets/asset_list.html
@@ -1,7 +1,6 @@
{% extends '_base_list.html' %}
{% load i18n %}
{% load static %}
-{% load common_tags %}
{% block custom_head_css_js %}
@@ -33,7 +32,7 @@
{% for tag in tag_list %}
{% else %}
class="tagBtn2 label label-default">
@@ -105,6 +104,38 @@ function tagShow() {
}
} //onload;
+function objDelete(obj, name, url) {
+ function doDelete() {
+ var body = {};
+ var success = function() {
+ swal('Deleted!', "[ "+name+"]"+" has been deleted ", "success");
+ $(obj).parent().parent().remove();
+ };
+ var fail = function() {
+ swal("Failed", "Delete"+"[ "+name+" ]"+"failed", "error");
+ };
+ APIUpdateAttr({
+ url: url,
+ body: JSON.stringify(body),
+ method: 'DELETE',
+ success: success,
+ error: fail
+ });
+ }
+ swal({
+ title: 'Are you sure delete ?',
+ text: " [" + name + "] ",
+ type: "warning",
+ showCancelButton: true,
+ cancelButtonText: 'Cancel',
+ confirmButtonColor: "#DD6B55",
+ confirmButtonText: 'Confirm',
+ closeOnConfirm: false
+ }, function () {
+ doDelete()
+ });
+}
+
$(document).ready(function(){
var options = {
ele: $('#asset_list_table'),
@@ -187,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);
- objectDelete($this, name, the_url);
- $data_table.ajax.reload();
+ console.log(the_url);
+ objDelete($this, name, the_url);
+ setTimeout( function () {
+ $data_table.ajax.reload();
+ }, 3000);
})
.on('click', '#btn_bulk_update', function () {
@@ -324,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');
});
+
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/apps/assets/templates/assets/asset_tag_detail.html b/apps/assets/templates/assets/asset_tag_detail.html
index ac190af17..a479034fc 100644
--- a/apps/assets/templates/assets/asset_tag_detail.html
+++ b/apps/assets/templates/assets/asset_tag_detail.html
@@ -1,6 +1,4 @@
{% extends 'base.html' %}
-{% load common_tags %}
-{% load users_tags %}
{% load static %}
{% load i18n %}
@@ -276,4 +274,4 @@ $(document).ready(function () {
deleteTagAssets($this, name, the_url, data);
});
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/apps/assets/templates/assets/asset_tags_list.html b/apps/assets/templates/assets/asset_tags_list.html
index 7c3e20c7c..21df7e19b 100644
--- a/apps/assets/templates/assets/asset_tags_list.html
+++ b/apps/assets/templates/assets/asset_tags_list.html
@@ -1,6 +1,5 @@
{% extends '_base_list.html' %}
{% load i18n static %}
-{#{% load common_tags %}#}
{% block custom_head_css_js %}
@@ -123,4 +122,4 @@ $(document).ready(function () {
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/apps/assets/templates/assets/idc_assets.html b/apps/assets/templates/assets/idc_assets.html
index b9976a966..3c21728bb 100644
--- a/apps/assets/templates/assets/idc_assets.html
+++ b/apps/assets/templates/assets/idc_assets.html
@@ -1,6 +1,4 @@
{% extends 'base.html' %}
-{% load common_tags %}
-{% load users_tags %}
{% load static %}
{% load i18n %}
@@ -365,4 +363,4 @@ $(document).ready(function () {
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/apps/assets/templates/assets/idc_create_update.html b/apps/assets/templates/assets/idc_create_update.html
index 8a79d8fa3..67c7f4c55 100644
--- a/apps/assets/templates/assets/idc_create_update.html
+++ b/apps/assets/templates/assets/idc_create_update.html
@@ -41,6 +41,7 @@
+ {{ form.operator|bootstrap_horizontal }}
{{ form.intranet|bootstrap_horizontal }}
{{ form.extranet|bootstrap_horizontal }}
diff --git a/apps/assets/templates/assets/idc_detail.html b/apps/assets/templates/assets/idc_detail.html
index d385be615..58082a4e0 100644
--- a/apps/assets/templates/assets/idc_detail.html
+++ b/apps/assets/templates/assets/idc_detail.html
@@ -1,6 +1,4 @@
{% extends 'base.html' %}
-{% load common_tags %}
-{% load users_tags %}
{% load static %}
{% load i18n %}
@@ -155,4 +153,4 @@ $(document).ready(function () {
idcDelete(name, the_url);
});
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/apps/assets/templates/assets/system_user_asset.html b/apps/assets/templates/assets/system_user_asset.html
index 522c58144..21814879e 100644
--- a/apps/assets/templates/assets/system_user_asset.html
+++ b/apps/assets/templates/assets/system_user_asset.html
@@ -1,6 +1,4 @@
{% extends 'base.html' %}
-{% load common_tags %}
-{% load users_tags %}
{% load static %}
{% load i18n %}
@@ -370,4 +368,4 @@ $(document).ready(function () {
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/apps/assets/templates/assets/system_user_asset_group.html b/apps/assets/templates/assets/system_user_asset_group.html
index 52e48815c..13a21770e 100644
--- a/apps/assets/templates/assets/system_user_asset_group.html
+++ b/apps/assets/templates/assets/system_user_asset_group.html
@@ -1,6 +1,4 @@
{% extends 'base.html' %}
-{% load common_tags %}
-{% load users_tags %}
{% load static %}
{% load i18n %}
@@ -133,4 +131,4 @@
$('.select2').select2();
});
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/apps/assets/templates/assets/system_user_detail.html b/apps/assets/templates/assets/system_user_detail.html
index 4367b1c3a..342cfbb55 100644
--- a/apps/assets/templates/assets/system_user_detail.html
+++ b/apps/assets/templates/assets/system_user_detail.html
@@ -1,6 +1,4 @@
{% extends 'base.html' %}
-{% load common_tags %}
-{% load users_tags %}
{% load static %}
{% load i18n %}
@@ -184,4 +182,4 @@
$('.select2').select2();
});
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/apps/assets/templates/assets/system_user_list.html b/apps/assets/templates/assets/system_user_list.html
index ba264541c..51b6456b4 100644
--- a/apps/assets/templates/assets/system_user_list.html
+++ b/apps/assets/templates/assets/system_user_list.html
@@ -1,6 +1,5 @@
{% extends '_base_list.html' %}
{% load i18n %}
-{% load common_tags %}
{% block table_search %}
{% endblock %}
@@ -75,7 +74,9 @@ $(document).ready(function(){
var uid = $this.data('uid');
var the_url = '{% url "api-assets:system-user-detail" pk=99991937 %}'.replace('99991937', uid);
objectDelete($this, name, the_url);
- $data_table.ajax.reload();
+ setTimeout( function () {
+ $data_table.ajax.reload();
+ }, 3000);
})
.on('click', '#btn_bulk_update', function () {
diff --git a/apps/assets/views.py b/apps/assets/views.py
index 497bf2a31..df9a4b1e2 100644
--- a/apps/assets/views.py
+++ b/apps/assets/views.py
@@ -139,15 +139,15 @@ 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
+ # 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
diff --git a/apps/audits/templates/audits/command_log_list.html b/apps/audits/templates/audits/command_log_list.html
index 3ed7d5d0b..0a0ced6dc 100644
--- a/apps/audits/templates/audits/command_log_list.html
+++ b/apps/audits/templates/audits/command_log_list.html
@@ -1,7 +1,6 @@
{% extends '_base_list.html' %}
{% load i18n %}
{% load static %}
-{% load common_tags %}
{% block content_left_head %}
diff --git a/apps/audits/templates/audits/proxy_log_detail.html b/apps/audits/templates/audits/proxy_log_detail.html
index c1b1dea57..909d66fe6 100644
--- a/apps/audits/templates/audits/proxy_log_detail.html
+++ b/apps/audits/templates/audits/proxy_log_detail.html
@@ -1,5 +1,4 @@
{% extends 'base.html' %}
-{% load common_tags %}
{% load static %}
{% load i18n %}
diff --git a/apps/audits/templates/audits/proxy_log_list.html b/apps/audits/templates/audits/proxy_log_list.html
index b60b54e31..6a3c815b0 100644
--- a/apps/audits/templates/audits/proxy_log_list.html
+++ b/apps/audits/templates/audits/proxy_log_list.html
@@ -1,7 +1,6 @@
{% extends '_base_list.html' %}
{% load i18n %}
{% load static %}
-{% load common_tags %}
{% block content_left_head %}