Filtering device components per device role fails #9835

Closed
opened 2025-12-29 21:23:23 +01:00 by adam · 2 comments
Owner

Originally created by @Alef-Burzmali on GitHub (Jun 12, 2024).

Originally assigned to: @Alef-Burzmali on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.0.5

Python Version

3.10

Steps to Reproduce

  1. Create a device role "role_1" and "role_2"
  2. Create a device "device_1" with role "role_1" and a device "device_2" with "role_2"
  3. Create an interface on device_1 and another on device_2
  4. In the Interface list, use the Filters tab to filter on device role role_1

Expected Behavior

Only interfaces of devices with role_1 are displayed.

Observed Behavior

All the interfaces are displayed, the list is not filtered.

Originally created by @Alef-Burzmali on GitHub (Jun 12, 2024). Originally assigned to: @Alef-Burzmali on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.0.5 ### Python Version 3.10 ### Steps to Reproduce 1. Create a device role "role_1" and "role_2" 2. Create a device "device_1" with role "role_1" and a device "device_2" with "role_2" 3. Create an interface on device_1 and another on device_2 4. In the Interface list, use the Filters tab to filter on device role role_1 ### Expected Behavior Only interfaces of devices with role_1 are displayed. ### Observed Behavior All the interfaces are displayed, the list is not filtered.
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:23:24 +01:00
adam closed this issue 2025-12-29 21:23:24 +01:00
Author
Owner

@Alef-Burzmali commented on GitHub (Jun 12, 2024):

The cause seems to be that DeviceComponentFilterForm still uses field device_role_id while DeviceComponentFilterSet has been updated by #15099 to expect role_id parameter. If the URL query parameter is changed to role_id , then the list is filtered as expected.

83da49cfa3/netbox/dcim/forms/filtersets.py (L114-L118)

I can submit a PR, if assigned.

@Alef-Burzmali commented on GitHub (Jun 12, 2024): The cause seems to be that `DeviceComponentFilterForm` still uses field `device_role_id` while `DeviceComponentFilterSet` has been updated by #15099 to expect `role_id` parameter. If the URL query parameter is changed to `role_id` , then the list is filtered as expected. https://github.com/netbox-community/netbox/blob/83da49cfa3950f5acb1e48bb5aa9943999a782cf/netbox/dcim/forms/filtersets.py#L114-L118 I can submit a PR, if assigned.
Author
Owner

@jeremystretch commented on GitHub (Jun 13, 2024):

Thanks @Alef-Burzmali, I've assigned this to you.

@jeremystretch commented on GitHub (Jun 13, 2024): Thanks @Alef-Burzmali, I've assigned this to you.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9835