[PR #16994] [MERGED] Fixes #16782: Add object filtering for custom fields #14975

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/16994
Author: @samk-acw
Created: 7/26/2024
Status: Merged
Merged: 7/29/2024
Merged by: @jeremystretch

Base: featureHead: 16782-cfobjectfilter-2


📝 Commits (3)

  • c2b36df Fixes #16782: Add object filtering for custom fields
  • 8a594d0 Add validation for related_object_filter
  • ecb680d Extend documentation & misc cleanup

📊 Changes

8 files changed (+60 additions, -4 deletions)

View changed files

📝 docs/customization/custom-fields.md (+2 -0)
📝 docs/models/extras/customfield.md (+7 -0)
📝 netbox/extras/api/serializers_/customfields.py (+1 -1)
📝 netbox/extras/forms/model_forms.py (+1 -1)
netbox/extras/migrations/0120_customfield_related_object_filter.py (+18 -0)
📝 netbox/extras/models/customfields.py (+22 -1)
📝 netbox/extras/tests/test_filtersets.py (+1 -1)
📝 netbox/templates/extras/customfield.html (+8 -0)

📄 Description

Fixes: #16782

(new pr rebased off feature branch)

  • adds 'related_object_filter' field to CustomField model and relevant form, template and api serializer
  • updated CustomField's to_form_field method to load the query_param data
  • added documentation
  • currently I've chosen to not to include any additional validation as it feels fairly fail-safe already; json syntax is already validated by the field type, and entering an invalid query_params definition results in the filter returning all values, which is the default behavior anyway

🔄 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/16994 **Author:** [@samk-acw](https://github.com/samk-acw) **Created:** 7/26/2024 **Status:** ✅ Merged **Merged:** 7/29/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `16782-cfobjectfilter-2` --- ### 📝 Commits (3) - [`c2b36df`](https://github.com/netbox-community/netbox/commit/c2b36df3771dea3c161d10755495a44b3a0fa30c) Fixes #16782: Add object filtering for custom fields - [`8a594d0`](https://github.com/netbox-community/netbox/commit/8a594d0a49ff2290b4b9f0fc0a8be3fe788cd58d) Add validation for related_object_filter - [`ecb680d`](https://github.com/netbox-community/netbox/commit/ecb680dd19a194625f38ff3d24ed63a73b8aed53) Extend documentation & misc cleanup ### 📊 Changes **8 files changed** (+60 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `docs/customization/custom-fields.md` (+2 -0) 📝 `docs/models/extras/customfield.md` (+7 -0) 📝 `netbox/extras/api/serializers_/customfields.py` (+1 -1) 📝 `netbox/extras/forms/model_forms.py` (+1 -1) ➕ `netbox/extras/migrations/0120_customfield_related_object_filter.py` (+18 -0) 📝 `netbox/extras/models/customfields.py` (+22 -1) 📝 `netbox/extras/tests/test_filtersets.py` (+1 -1) 📝 `netbox/templates/extras/customfield.html` (+8 -0) </details> ### 📄 Description ### Fixes: #16782 (new pr rebased off feature branch) - adds 'related_object_filter' field to CustomField model and relevant form, template and api serializer - updated CustomField's to_form_field method to load the query_param data - added documentation - currently I've chosen to not to include any additional validation as it feels fairly fail-safe already; json syntax is already validated by the field type, and entering an invalid query_params definition results in the filter returning all values, which is the default behavior anyway --- <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:19:13 +01:00
adam closed this issue 2025-12-30 00:19: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#14975