Commit 736c58ce authored by ibuler's avatar ibuler

修改bug

parent a8ce9e99
......@@ -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'添加成功'
......
......@@ -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 %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment