diff --git a/jpermission/views.py b/jpermission/views.py index bdd27a3fa..55171d70b 100644 --- a/jpermission/views.py +++ b/jpermission/views.py @@ -30,11 +30,11 @@ def perm_add(request): else: username = request.POST.get('username', None) - host_ips = request.POST.getlist('host_ips', None) + host_ids = request.POST.getlist('host_ids', None) user = User.objects.get(username=username) - for ip in host_ips: - asset = Asset.objects.get(ip=ip) + for id in host_ids: + asset = Asset.objects.get(id=id) perm = Permission(user=user, asset=asset) perm.save() msg = u'添加成功' diff --git a/templates/jperm/perm_add.html b/templates/jperm/perm_add.html index d4b2a75c8..77c8dc617 100644 --- a/templates/jperm/perm_add.html +++ b/templates/jperm/perm_add.html @@ -42,7 +42,7 @@
- {% for host in hosts %} {% endfor %}