Closes #20900: Add FilterSet-aware CustomField form fields #724

Closed
opened 2026-04-05 17:18:57 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @pheus on 12/16/2025

Fixes: #20900

This PR improves the UX for filtering on Selection-type custom fields by allowing users to pick multiple values in the filter form, while keeping the field single-valued everywhere else.

  • Add a for_filterset_form flag to CustomField.to_form_field() so filter forms can request filter-specific field/widget behavior.
  • When for_filterset_form=True, render Selection custom fields using a multi-select field/widget (without changing create/edit/bulk-edit behavior).
  • Update NetBoxModelFilterSetForm to pass for_filterset_form=True when constructing custom-field-backed filter fields.
*Originally created by @pheus on 12/16/2025* <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be approved and assigned prior to opening a pull request. This helps avoid waste time and effort on a proposed change that we might not be able to accept. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED TO YOU, IT WILL BE CLOSED AUTOMATICALLY. Please specify your assigned issue number on the line below. --> ### Fixes: #20900 <!-- Please include a summary of the proposed changes below. --> This PR improves the UX for filtering on **Selection**-type custom fields by allowing users to pick **multiple values** in the filter form, while keeping the field **single-valued** everywhere else. - Add a `for_filterset_form` flag to `CustomField.to_form_field()` so filter forms can request filter-specific field/widget behavior. - When `for_filterset_form=True`, render `Selection` custom fields using a multi-select field/widget (without changing create/edit/bulk-edit behavior). - Update `NetBoxModelFilterSetForm` to pass `for_filterset_form=True` when constructing custom-field-backed filter fields.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#724