From 5bdcacfd5283afe872d231aa29f8518805a2ee69 Mon Sep 17 00:00:00 2001 From: honglei5181 Date: Wed, 11 May 2016 09:57:09 +0800 Subject: [PATCH] fix bug --- groups/views.py | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/groups/views.py b/groups/views.py index b9a1c5e..a432ac6 100644 --- a/groups/views.py +++ b/groups/views.py @@ -141,13 +141,11 @@ def manage_host(request,*args,**kw): @login_required(login_url="/account/login/") def del_host(request): -<<<<<<< HEAD _success=False _error=False _ids=request.POST.getlist("id") _minion_ids=[] - #try: - if 1: + try: _filter=Hosts.objects.filter(id__in=_ids) for _m in _filter: _minion_ids.append(_m.minion.id) @@ -157,32 +155,10 @@ def del_host(request): #delete hosts _filter.delete() _success="Delete opearation success!" - #except Exception as e: - else: + except Exception as e: _error="Delete opearation error!" - return manage_host(request,success=_success,error=_error) -======= - _success=False - _error=False - _ids=request.POST.getlist("id") - _minion_ids=[] - try: - _filter=Hosts.objects.filter(id__in=_ids) - for _m in _filter: - _minion_ids.append(_m.minion.id) - #delete minion_status - _m_filter = Minions_status.objects.filter(id__in=_minion_ids) - _m_filter.delete() - #delete hosts - _filter.delete() - _success="Delete opearation success!" - except Exception as e: - _error="Delete opearation error!" - - ->>>>>>> saltshaker-dev @login_required(login_url="/account/login/") def modify_host(request): _success=False