diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index 7bb8bcc7d..f84760418 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -403,8 +403,15 @@ class PrefixPrefixesView(generic.ObjectView): bulk_querystring = 'vrf_id={}&within={}'.format(instance.vrf.pk if instance.vrf else '0', instance.prefix) + # Compile permissions list for rendering the object table + permissions = { + 'change': request.user.has_perm('ipam.change_prefix'), + 'delete': request.user.has_perm('ipam.delete_prefix'), + } + return { 'table': table, + 'permissions': permissions, 'bulk_querystring': bulk_querystring, 'active_tab': 'prefixes', 'first_available_prefix': instance.get_first_available_prefix(), @@ -429,7 +436,6 @@ class PrefixIPRangesView(generic.ObjectView): # Compile permissions list for rendering the object table permissions = { - 'add': request.user.has_perm('ipam.add_iprange'), 'change': request.user.has_perm('ipam.change_iprange'), 'delete': request.user.has_perm('ipam.delete_iprange'), } @@ -465,7 +471,6 @@ class PrefixIPAddressesView(generic.ObjectView): # Compile permissions list for rendering the object table permissions = { - 'add': request.user.has_perm('ipam.add_ipaddress'), 'change': request.user.has_perm('ipam.change_ipaddress'), 'delete': request.user.has_perm('ipam.delete_ipaddress'), } diff --git a/netbox/templates/ipam/prefix/ip_addresses.html b/netbox/templates/ipam/prefix/ip_addresses.html index cf729123c..5aaacabe1 100644 --- a/netbox/templates/ipam/prefix/ip_addresses.html +++ b/netbox/templates/ipam/prefix/ip_addresses.html @@ -3,8 +3,8 @@ {% load static %} {% block extra_controls %} - {% if perms.ipam.add_ipaddress and active_tab == 'ip-addresses' and first_available_ip %} - + {% if perms.ipam.add_ipaddress and first_available_ip %} + Add IP Address {% endif %} diff --git a/netbox/templates/ipam/prefix/prefixes.html b/netbox/templates/ipam/prefix/prefixes.html index 492536b64..e6c109a39 100644 --- a/netbox/templates/ipam/prefix/prefixes.html +++ b/netbox/templates/ipam/prefix/prefixes.html @@ -4,15 +4,9 @@ {% block extra_controls %} {% include 'ipam/inc/toggle_available.html' %} - {% if perms.ipam.add_prefix and active_tab == 'prefixes' and first_available_prefix %} + {% if perms.ipam.add_prefix and first_available_prefix %} - Add Child Prefix - - {% endif %} - {% if perms.ipam.add_ipaddress and active_tab == 'ip-addresses' and first_available_ip %} - - - Add Child IP Address + Add Prefix {% endif %} {{ block.super }}