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' %} +