aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt/netbox/files/patch-netbox_ipam_tables.py
blob: 616ff4000e09de7b93cd64ab97f1efa9ef050827 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Fix unable to assign existing IP addresses to interfaces

Obtained from:
https://github.com/netbox-community/netbox/commit/1acdf58a4bb35d83a280464ac69aa961ff614df7

--- netbox/ipam/tables.py.orig	2019-12-15 11:43:12 UTC
+++ netbox/ipam/tables.py
@@ -85,7 +85,11 @@ IPADDRESS_LINK = """
 """
 
 IPADDRESS_ASSIGN_LINK = """
-<a href="{% url 'ipam:ipaddress_edit' pk=record.pk %}?interface={{ record.interface.pk }}&return_url={{ request.path }}">{{ record }}</a>
+{% if request.GET %}
+    <a href="{% url 'ipam:ipaddress_edit' pk=record.pk %}?interface={{ request.GET.interface }}&return_url={{ request.GET.return_url }}">{{ record }}</a>
+{% else %}
+    <a href="{% url 'ipam:ipaddress_edit' pk=record.pk %}?interface={{ record.interface.pk }}&return_url={{ request.path }}">{{ record }}</a>
+{% endif %}
 """
 
 IPADDRESS_PARENT = """