Add to filter ability to select multiply values from custom field with 'Type = Selection' #11881

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

Originally created by @mtroshyn on GitHub (Nov 28, 2025).

Originally assigned to: @pheus on GitHub.

NetBox version

v4.2.2

Feature type

New functionality

Proposed functionality

First, I will show the problem on screenshot. We have custom field 'Client' with type = Selection. The selection stores several thousands of choises. We use this custom field in rack object.
Image

When we try to use rack filter and select several values from custom field 'Client', we can't do it. Netbox allows to choose only one choice.
Image

My proposal is to implement ability to choose several values in filter for custom fields with type = selection.

Use case

This feature improve user experience working with netbox. Also it saves time to get information from netbox based on some criteria.

Database changes

No response

External dependencies

No response

Originally created by @mtroshyn on GitHub (Nov 28, 2025). Originally assigned to: @pheus on GitHub. ### NetBox version v4.2.2 ### Feature type New functionality ### Proposed functionality First, I will show the problem on screenshot. We have custom field 'Client' with type = Selection. The selection stores several thousands of choises. We use this custom field in rack object. <img width="1440" height="763" alt="Image" src="https://github.com/user-attachments/assets/7e7e8107-0043-483c-bffe-ff139ce688ad" /> When we try to use rack filter and select several values from custom field 'Client', we can't do it. Netbox allows to choose only one choice. <img width="1440" height="754" alt="Image" src="https://github.com/user-attachments/assets/a9c65971-51e2-44db-9771-82a67d177be3" /> My proposal is to implement ability to choose several values in filter for custom fields with type = selection. ### Use case This feature improve user experience working with netbox. Also it saves time to get information from netbox based on some criteria. ### Database changes _No response_ ### External dependencies _No response_
adam added the status: acceptedtype: featurenetboxcomplexity: low labels 2025-12-29 21:51:11 +01:00
adam closed this issue 2025-12-29 21:51:11 +01:00
Author
Owner

@pheus commented on GitHub (Dec 10, 2025):

I had a quick look at the CustomField.to_form_field() helper. As it stands, the TYPE_SELECT custom field always maps to a single-value choice field & widget, even when it’s used to build filter forms. That’s why the rack filter UI only allows picking one value from a selection-type custom field today.

To address this, I’d like to extend to_form_field() with a for_filter_form flag, similar to the existing for_csv_import argument. When for_filter_form=True and type == TYPE_SELECT, we could return a multiple-choice field (e.g. using APISelectMultiple), while keeping the existing behavior unchanged for create/edit/bulk-edit forms.

If this approach sounds acceptable, I’d be happy to pick this up and open a PR.

@pheus commented on GitHub (Dec 10, 2025): I had a quick look at the `CustomField.to_form_field()` helper. As it stands, the `TYPE_SELECT` custom field always maps to a single-value choice field & widget, even when it’s used to build filter forms. That’s why the rack filter UI only allows picking one value from a selection-type custom field today. To address this, I’d like to extend `to_form_field()` with a `for_filter_form` flag, similar to the existing `for_csv_import` argument. When `for_filter_form=True` and `type == TYPE_SELECT`, we could return a multiple-choice field (e.g. using `APISelectMultiple`), while keeping the existing behavior unchanged for create/edit/bulk-edit forms. If this approach sounds acceptable, I’d be happy to pick this up and open a PR.
Author
Owner

@jnovinger commented on GitHub (Dec 15, 2025):

Sounds workable, @pheus. Assigning now.

@jnovinger commented on GitHub (Dec 15, 2025): Sounds workable, @pheus. Assigning now.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11881