修改bug

pull/6/head
ibuler 2015-01-22 00:01:30 +08:00
parent a8ce9e9952
commit 736c58ce05
2 changed files with 4 additions and 4 deletions

View File

@ -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'添加成功'

View File

@ -42,7 +42,7 @@
</div>
<div class="form-group">
<div class="col-sm-8">
<select id="host_ips" name="host_ips" multiple style="width: 100%">
<select id="host_ids" name="host_ids" multiple style="width: 100%">
{% for host in hosts %}
<option value="{{ host.id }}">{{ host.ip }}</option>
{% endfor %}