[PR #20992] [MERGED] Closes #20900: Add FilterSet-aware CustomField form fields #16111

Closed
opened 2025-12-30 00:25:51 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20992
Author: @pheus
Created: 12/16/2025
Status: Merged
Merged: 12/17/2025
Merged by: @jnovinger

Base: mainHead: 20900-add-customfield-multiselect-filterform


📝 Commits (1)

  • 2f5865a feat(forms): Add FilterSet-aware CustomField form fields

📊 Changes

2 files changed (+13 additions, -3 deletions)

View changed files

📝 netbox/extras/models/customfields.py (+10 -2)
📝 netbox/netbox/forms/base.py (+3 -1)

📄 Description

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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/20992 **Author:** [@pheus](https://github.com/pheus) **Created:** 12/16/2025 **Status:** ✅ Merged **Merged:** 12/17/2025 **Merged by:** [@jnovinger](https://github.com/jnovinger) **Base:** `main` ← **Head:** `20900-add-customfield-multiselect-filterform` --- ### 📝 Commits (1) - [`2f5865a`](https://github.com/netbox-community/netbox/commit/2f5865a8de9c33117d25ed0274e83e5768be1c5d) feat(forms): Add FilterSet-aware CustomField form fields ### 📊 Changes **2 files changed** (+13 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/models/customfields.py` (+10 -2) 📝 `netbox/netbox/forms/base.py` (+3 -1) </details> ### 📄 Description <!-- 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:25:51 +01:00
adam closed this issue 2025-12-30 00:25:52 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#16111