Commit ad85f38e by Kálmán Viktor

dashboard: filter already added interfaces

parent bbe883da
......@@ -104,7 +104,7 @@
<h4>{% trans "This VM doesn't have an IPv6 address!" %}</h4>
{% endif %}
</div><!-- /ipv6 -->
{% include "dashboard/vm-detail/network-port-add.html" %}
{% include "dashboard/vm-detail/_network-port-add.html" %}
</div>
</div>
</div>
......@@ -121,6 +121,9 @@
{% csrf_token %}
<div class="input-group" style="max-width: 330px;">
<select name="new_network_vlan" class="form-control">
{% if vlans|length == 0 %}
<option value="-1">No more networks!</option>
{% endif %}
{% for v in vlans %}
<option value="{{ v.pk }}">{{ v.name }}</option>
{% endfor %}
......
......@@ -154,7 +154,11 @@ class VmDetailView(CheckedDetailView):
context['activity'] = ia
context['vlans'] = Vlan.get_objects_with_level(
'user', self.request.user).all()
'user', self.request.user
).exclude(
pk__in=Interface.objects.filter(
instance=self.get_object()).values_list("vlan", flat=True)
).all()
context['acl'] = get_acl_data(instance)
context['forms'] = {
'disk_add_form': DiskAddForm(prefix="disk"),
......
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 sign in to comment