[PR #16661] [MERGED] Closes #8198: Custom field uniqueness #14878

Closed
opened 2025-12-29 23:27:14 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/16661
Author: @jeremystretch
Created: 6/19/2024
Status: Merged
Merged: 6/25/2024
Merged by: @jeremystretch

Base: featureHead: 8198-custom-field-uniqueness


📝 Commits (3)

  • 7391a47 Closes #8198: Implement ability to enforce custom field uniqueness
  • 837d402 Add missing form fields & table columns for validation attributes
  • cb88a2f Remove obsolete code

📊 Changes

16 files changed (+142 additions, -17 deletions)

View changed files

📝 docs/models/extras/customfield.md (+4 -0)
📝 netbox/extras/api/customfields.py (+2 -1)
📝 netbox/extras/api/serializers_/customfields.py (+1 -1)
📝 netbox/extras/constants.py (+2 -0)
📝 netbox/extras/filtersets.py (+1 -1)
📝 netbox/extras/forms/bulk_edit.py (+25 -0)
📝 netbox/extras/forms/bulk_import.py (+2 -1)
📝 netbox/extras/forms/filtersets.py (+22 -0)
📝 netbox/extras/forms/model_forms.py (+3 -1)
netbox/extras/migrations/0117_customfield_uniqueness.py (+16 -0)
📝 netbox/extras/models/customfields.py (+12 -1)
📝 netbox/extras/tables/tables.py (+14 -2)
netbox/extras/tables/template_code.py (+0 -8)
📝 netbox/extras/tests/test_customfields.py (+23 -0)
📝 netbox/netbox/models/features.py (+11 -1)
📝 netbox/templates/extras/customfield.html (+4 -0)

📄 Description

Closes: #8198

  • Introduce CUSTOMFIELD_EMPTY_VALUES to standardize the set of "empty" values for custom fields
  • Add a validation_unique field to CustomModel
  • Extend CustomFieldsMixin to handle the uniquess validation
  • Add missing form fields and table columns for other CF validation fields
  • Add uniqueness validation test
  • Remove obsolete table template code

🔄 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/16661 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 6/19/2024 **Status:** ✅ Merged **Merged:** 6/25/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `8198-custom-field-uniqueness` --- ### 📝 Commits (3) - [`7391a47`](https://github.com/netbox-community/netbox/commit/7391a471b02a69492e657ef77ca346b783cfaee6) Closes #8198: Implement ability to enforce custom field uniqueness - [`837d402`](https://github.com/netbox-community/netbox/commit/837d402f1d4252ddb109e3ea08c494784bf66015) Add missing form fields & table columns for validation attributes - [`cb88a2f`](https://github.com/netbox-community/netbox/commit/cb88a2f6ba75493451685fabc5ed683d7488875b) Remove obsolete code ### 📊 Changes **16 files changed** (+142 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `docs/models/extras/customfield.md` (+4 -0) 📝 `netbox/extras/api/customfields.py` (+2 -1) 📝 `netbox/extras/api/serializers_/customfields.py` (+1 -1) 📝 `netbox/extras/constants.py` (+2 -0) 📝 `netbox/extras/filtersets.py` (+1 -1) 📝 `netbox/extras/forms/bulk_edit.py` (+25 -0) 📝 `netbox/extras/forms/bulk_import.py` (+2 -1) 📝 `netbox/extras/forms/filtersets.py` (+22 -0) 📝 `netbox/extras/forms/model_forms.py` (+3 -1) ➕ `netbox/extras/migrations/0117_customfield_uniqueness.py` (+16 -0) 📝 `netbox/extras/models/customfields.py` (+12 -1) 📝 `netbox/extras/tables/tables.py` (+14 -2) ➖ `netbox/extras/tables/template_code.py` (+0 -8) 📝 `netbox/extras/tests/test_customfields.py` (+23 -0) 📝 `netbox/netbox/models/features.py` (+11 -1) 📝 `netbox/templates/extras/customfield.html` (+4 -0) </details> ### 📄 Description ### Closes: #8198 - Introduce `CUSTOMFIELD_EMPTY_VALUES` to standardize the set of "empty" values for custom fields - Add a `validation_unique` field to CustomModel - Extend CustomFieldsMixin to handle the uniquess validation - Add missing form fields and table columns for other CF validation fields - Add uniqueness validation test - Remove obsolete table template code --- <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-29 23:27:14 +01:00
adam closed this issue 2025-12-29 23:27:14 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#14878