From 95bb96ebbf18a5164e88b95ab89357e549527334 Mon Sep 17 00:00:00 2001 From: halcyon <864072399@qq.com> Date: Sat, 7 Mar 2015 18:37:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=84=E7=A7=8Dbug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jasset/urls.py | 4 ++-- jasset/views.py | 24 +++++++++++++++++++--- templates/jasset/group_list.html | 34 +++++++++++++++++++++++++++++-- templates/jasset/host_list.html | 8 +++++++- templates/jasset/host_search.html | 33 +----------------------------- templates/jasset/idc_list.html | 34 ++++++++++++++++++++++++++++++- templates/jlog/log_offline.html | 6 +++++- templates/jlog/log_online.html | 6 +++++- 8 files changed, 106 insertions(+), 43 deletions(-) diff --git a/jasset/urls.py b/jasset/urls.py index 386538a74..602ed6a69 100644 --- a/jasset/urls.py +++ b/jasset/urls.py @@ -12,13 +12,13 @@ urlpatterns = patterns('', url(r'^idc_add/$', add_idc), url(r'^idc_list/$', list_idc), url(r'^idc_detail/$', detail_idc), - url(r'^idc_del/(\d+)/$', del_idc), + url(r'^idc_del/(\w+)/$', del_idc), url(r'^jgroup_add/$', add_group), url(r'^group_edit/$', edit_group), url(r'^jgroup_list/$', list_group), url(r'^group_detail/$', detail_group), url(r'^group_del_host/(\w+)/$', group_del_host), - url(r'^group_del/(\d+)/$', group_del), + url(r'^group_del/(\w+)/$', group_del), url(r'^host_del/(\w+)/$', host_del), url(r'^host_edit/$', host_edit), url(r'^host_edit/batch/$', batch_host_edit), diff --git a/jasset/views.py b/jasset/views.py index 757c9770c..2b8b4bbda 100644 --- a/jasset/views.py +++ b/jasset/views.py @@ -251,7 +251,15 @@ def list_idc(request): def del_idc(request, offset): - IDC.objects.filter(id=offset).delete() + if offset == 'multi': + len_list = request.POST.get("len_list") + for i in range(int(len_list)): + key = "id_list[" + str(i) + "]" + gid = request.POST.get(key) + IDC.objects.filter(id=gid).delete() + else: + gid = int(offset) + IDC.objects.filter(id=gid).delete() return HttpResponseRedirect('/jasset/idc_list/') @@ -354,8 +362,18 @@ def group_del_host(request, offset): def group_del(request, offset): - BisGroup.objects.filter(id=offset).delete() - return HttpResponseRedirect('/jasset/group_list/') + if offset == 'multi': + len_list = request.POST.get("len_list") + for i in range(int(len_list)): + key = "id_list[" + str(i) + "]" + gid = request.POST.get(key) + BisGroup.objects.filter(id=gid).delete() + else: + gid = int(offset) + BisGroup.objects.filter(id=gid).delete() + return HttpResponseRedirect('/jasset/jgroup_list/') + + def host_search(request): diff --git a/templates/jasset/group_list.html b/templates/jasset/group_list.html index b427266ca..a9e62dc17 100644 --- a/templates/jasset/group_list.html +++ b/templates/jasset/group_list.html @@ -38,7 +38,13 @@ {% endfor %} - {% include 'paginator.html' %} +
+
+ + +
+ {% include 'paginator.html' %} +
@@ -46,4 +52,28 @@ -{% endblock %} \ No newline at end of file + + +{% endblock %} diff --git a/templates/jasset/host_list.html b/templates/jasset/host_list.html index 4f24879c6..5638342d8 100644 --- a/templates/jasset/host_list.html +++ b/templates/jasset/host_list.html @@ -81,7 +81,13 @@ {% endfor %} - {% include 'paginator.html' %} +
+
+ + +
+ {% include 'paginator.html' %} +
diff --git a/templates/jasset/host_search.html b/templates/jasset/host_search.html index 2c9652926..11fe6ce14 100644 --- a/templates/jasset/host_search.html +++ b/templates/jasset/host_search.html @@ -40,38 +40,7 @@ -
-
- -
-
+ {% include 'paginator.html' %} + {% endblock %} \ No newline at end of file diff --git a/templates/jlog/log_offline.html b/templates/jlog/log_offline.html index abd621ac0..914eb04a5 100644 --- a/templates/jlog/log_offline.html +++ b/templates/jlog/log_offline.html @@ -96,7 +96,11 @@ {% endfor %} - {% include 'paginator.html' %} +
+
+
+ {% include 'paginator.html' %} +
diff --git a/templates/jlog/log_online.html b/templates/jlog/log_online.html index 582d08433..a5833c9c6 100644 --- a/templates/jlog/log_online.html +++ b/templates/jlog/log_online.html @@ -96,7 +96,11 @@ {% endfor %} - {% include 'paginator.html' %} +
+
+
+ {% include 'paginator.html' %} +