DeviceComponentFilterSet by name expects int instead of str. #836

Closed
opened 2025-12-29 16:26:13 +01:00 by adam · 0 comments
Owner

Originally created by @zachmoody on GitHub (Apr 5, 2017).

Issue type: Bug

Python version: 2.7.13
NetBox version: v2-develop

Searching for interfaces by device name yields a traceback.

Seems like this fixes. Will file a PR shortly.

diff --git a/netbox/dcim/filters.py b/netbox/dcim/filters.py
index 7992f8e..f94b172 100644
--- a/netbox/dcim/filters.py
+++ b/netbox/dcim/filters.py
@@ -401,7 +401,7 @@ class DeviceComponentFilterSet(django_filters.FilterSet):
         label='Device (ID)',
     )
     device = django_filters.ModelMultipleChoiceFilter(
-        name='device',
+        name='device__name',
         queryset=Device.objects.all(),
         to_field_name='name',
         label='Device (name)',
Originally created by @zachmoody on GitHub (Apr 5, 2017). <!-- Please note: GitHub issues are to be used only for feature requests and bug reports. For installation assistance or general discussion, please join us on the mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please indicate "bug report" or "feature request" below. Be sure to search the existing set of issues (both open and closed) to see if a similar issue has already been raised. --> ### Issue type: Bug <!-- If filing a bug, please indicate the version of Python and NetBox you are running. (This is not necessary for feature requests.) --> **Python version:** 2.7.13 **NetBox version:** v2-develop <!-- If filing a bug, please record the exact steps taken to reproduce the bug and any errors messages that are generated. If filing a feature request, please precisely describe the data model or workflow you would like to see implemented, and provide a use case. --> Searching for interfaces by device name yields a [traceback](http://dpaste.com/2N3D7J2). Seems like this fixes. Will file a PR shortly. ```diff diff --git a/netbox/dcim/filters.py b/netbox/dcim/filters.py index 7992f8e..f94b172 100644 --- a/netbox/dcim/filters.py +++ b/netbox/dcim/filters.py @@ -401,7 +401,7 @@ class DeviceComponentFilterSet(django_filters.FilterSet): label='Device (ID)', ) device = django_filters.ModelMultipleChoiceFilter( - name='device', + name='device__name', queryset=Device.objects.all(), to_field_name='name', label='Device (name)', ```
adam added the type: bug label 2025-12-29 16:26:13 +01:00
adam closed this issue 2025-12-29 16:26:13 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#836