From cc99d471906bc817f54733fe9df89e31a6f3bb14 Mon Sep 17 00:00:00 2001 From: Stephen Maunder Date: Wed, 5 Apr 2017 16:14:24 +0100 Subject: [PATCH] Assign IP Address to Interface from Interface List --- netbox/dcim/views.py | 4 +++- netbox/templates/dcim/inc/interface.html | 25 ++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index f2b042599..bfedcc455 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -1585,7 +1585,9 @@ def ipaddress_assign(request, pk): return redirect('dcim:device', pk=device.pk) else: - form = forms.IPAddressForm(device) + form = forms.IPAddressForm(device, initial={ + 'interface': request.GET.get('interface', None) + }) return render(request, 'dcim/ipaddress_assign.html', { 'device': device, diff --git a/netbox/templates/dcim/inc/interface.html b/netbox/templates/dcim/inc/interface.html index 7d7d66c2e..472727e4a 100644 --- a/netbox/templates/dcim/inc/interface.html +++ b/netbox/templates/dcim/inc/interface.html @@ -59,6 +59,11 @@ {% endif %} {% endif %} + {% if perms.ipam.add_ipaddress %} + + + + {% endif %} {% if perms.dcim.change_interface %} {% if not iface.is_virtual %} {% if iface.connection %} @@ -72,7 +77,7 @@ {% endif %} - + {% elif iface.circuit_termination and perms.circuits.change_circuittermination %}