IPRanges bulk options within Prefix view are missing #5280

Closed
opened 2025-12-29 19:26:09 +01:00 by adam · 1 comment
Owner

Originally created by @sdktr on GitHub (Sep 1, 2021).

Originally assigned to: @sdktr on GitHub.

NetBox version

v3.0.0

Python version

3.8

Steps to Reproduce

  1. Open the IP Ranges tab within a prefix example

Expected Behavior

The 'edit selected' and 'delete selected' buttons should appear

Observed Behavior

No bulk options available.

This is due to the same reason as #7092. I replicated the changes @thatmattlove made on that. Additionally, the actions tied to the buttons is incorrectly set to the wrong bulk edit page.

I have a patch ready for this if needed.

Originally created by @sdktr on GitHub (Sep 1, 2021). Originally assigned to: @sdktr on GitHub. ### NetBox version v3.0.0 ### Python version 3.8 ### Steps to Reproduce 1. Open the IP Ranges tab within a prefix [example](https://demo.netbox.dev/ipam/prefixes/43/ip-ranges/) ### Expected Behavior The 'edit selected' and 'delete selected' buttons should appear ### Observed Behavior No bulk options available. This is due to the same reason as #7092. I replicated the changes @thatmattlove made on that. Additionally, the actions tied to the buttons is incorrectly set to the wrong bulk edit page. I have a patch ready for this if needed.
adam added the type: bugstatus: accepted labels 2025-12-29 19:26:09 +01:00
adam closed this issue 2025-12-29 19:26:09 +01:00
Author
Owner

@sdktr commented on GitHub (Sep 1, 2021):

Fix missing permissions on the view:

diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py
index b33947f4e..7bb8bcc7d 100644
--- a/netbox/ipam/views.py
+++ b/netbox/ipam/views.py
@@ -427,8 +427,16 @@ class PrefixIPRangesView(generic.ObjectView):

         bulk_querystring = 'vrf_id={}&parent={}'.format(instance.vrf.pk if instance.vrf else '0', instance.prefix)

+        # 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'),
+        }
+
         return {
             'table': table,
+            'permissions': permissions,
             'bulk_querystring': bulk_querystring,
             'active_tab': 'ip-ranges',
         }

Fix the links to the wrong bulk action urls:

diff --git a/netbox/templates/ipam/prefix/ip_ranges.html b/netbox/templates/ipam/prefix/ip_ranges.html
index 18b53d945..3d15624bf 100644
--- a/netbox/templates/ipam/prefix/ip_ranges.html
+++ b/netbox/templates/ipam/prefix/ip_ranges.html
@@ -6,7 +6,7 @@
   <div class="row">
     <div class="col col-md-12">
       {% include 'inc/table_controls.html' with table_modal="IPRangeTable_config" %}
-      {% include 'utilities/obj_table.html' with heading='Child IP Ranges' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' parent=prefix %}
+      {% include 'utilities/obj_table.html' with heading='Child IP Ranges' bulk_edit_url='ipam:iprange_bulk_edit' bulk_delete_url='ipam:iprange_bulk_delete' parent=prefix %}
     </div>
   </div>
   {% table_config_form table table_name="IPRangeTable" %}
@sdktr commented on GitHub (Sep 1, 2021): Fix missing permissions on the view: ``` diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index b33947f4e..7bb8bcc7d 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -427,8 +427,16 @@ class PrefixIPRangesView(generic.ObjectView): bulk_querystring = 'vrf_id={}&parent={}'.format(instance.vrf.pk if instance.vrf else '0', instance.prefix) + # 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'), + } + return { 'table': table, + 'permissions': permissions, 'bulk_querystring': bulk_querystring, 'active_tab': 'ip-ranges', } ``` Fix the links to the wrong bulk action urls: ``` diff --git a/netbox/templates/ipam/prefix/ip_ranges.html b/netbox/templates/ipam/prefix/ip_ranges.html index 18b53d945..3d15624bf 100644 --- a/netbox/templates/ipam/prefix/ip_ranges.html +++ b/netbox/templates/ipam/prefix/ip_ranges.html @@ -6,7 +6,7 @@ <div class="row"> <div class="col col-md-12"> {% include 'inc/table_controls.html' with table_modal="IPRangeTable_config" %} - {% include 'utilities/obj_table.html' with heading='Child IP Ranges' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' parent=prefix %} + {% include 'utilities/obj_table.html' with heading='Child IP Ranges' bulk_edit_url='ipam:iprange_bulk_edit' bulk_delete_url='ipam:iprange_bulk_delete' parent=prefix %} </div> </div> {% table_config_form table table_name="IPRangeTable" %} ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5280