[PR #13195] [MERGED] Closes #12988: Introduce custom field choice sets #14128

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/13195
Author: @jeremystretch
Created: 7/17/2023
Status: Merged
Merged: 7/19/2023
Merged by: @jeremystretch

Base: featureHead: 12988-custom-field-choice-sets


📝 Commits (10+)

  • 70e1e11 Initial work on custom field choice sets
  • f3bfe29 Rename choices to extra_choices (prep for #12194)
  • 42a9407 Remove CustomField.choices
  • a32992e Add & update tests
  • 9f3ffb7 Clean up table columns
  • 9aff7e7 Add order_alphanetically boolean for choice sets
  • 1f5b583 Introduce ArrayColumn for choice lists
  • feedf51 Show dependent custom fields on choice set view
  • 00096cc Update custom fields documentation
  • ed2d78f Introduce ArrayWidget for more convenient editing of choices

📊 Changes

32 files changed (+792 additions, -150 deletions)

View changed files

📝 docs/customization/custom-fields.md (+1 -1)
📝 docs/models/extras/customfield.md (+2 -2)
docs/models/extras/customfieldchoiceset.md (+17 -0)
📝 netbox/extras/api/nested_serializers.py (+9 -0)
📝 netbox/extras/api/serializers.py (+14 -1)
📝 netbox/extras/api/urls.py (+1 -0)
📝 netbox/extras/api/views.py (+7 -2)
📝 netbox/extras/filtersets.py (+38 -0)
📝 netbox/extras/forms/bulk_edit.py (+23 -2)
📝 netbox/extras/forms/bulk_import.py (+24 -6)
📝 netbox/extras/forms/filtersets.py (+18 -2)
📝 netbox/extras/forms/model_forms.py (+23 -3)
📝 netbox/extras/graphql/schema.py (+6 -0)
📝 netbox/extras/graphql/types.py (+9 -0)
netbox/extras/migrations/0096_customfieldchoiceset.py (+61 -0)
netbox/extras/migrations/0097_customfield_remove_choices.py (+17 -0)
📝 netbox/extras/models/__init__.py (+1 -1)
📝 netbox/extras/models/customfields.py (+71 -18)
📝 netbox/extras/tables/tables.py (+34 -0)
📝 netbox/extras/tests/test_api.py (+37 -2)

...and 12 more files

📄 Description

Fixes: #12988

  • Introduce the new CustomFieldChoiceSet model
  • Automatically migrate all CF choices to the new model
  • Add a choice_set ForeignKey to CustomField and remove the choices array field
  • Introduce ArrayWidget to improve UX while editing choices

🔄 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/13195 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 7/17/2023 **Status:** ✅ Merged **Merged:** 7/19/2023 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `12988-custom-field-choice-sets` --- ### 📝 Commits (10+) - [`70e1e11`](https://github.com/netbox-community/netbox/commit/70e1e1197ee291c3ba357157954ad223161993a9) Initial work on custom field choice sets - [`f3bfe29`](https://github.com/netbox-community/netbox/commit/f3bfe2975115636df06425b9b6b45b918c4f4658) Rename choices to extra_choices (prep for #12194) - [`42a9407`](https://github.com/netbox-community/netbox/commit/42a94078cef31228e4920384bf9c959f7de0dfaf) Remove CustomField.choices - [`a32992e`](https://github.com/netbox-community/netbox/commit/a32992e166a5e4040bd190ed85ab2e6cbbbe6ea1) Add & update tests - [`9f3ffb7`](https://github.com/netbox-community/netbox/commit/9f3ffb70a7e8fb605fb7d4e0d1cbf52e34f856e0) Clean up table columns - [`9aff7e7`](https://github.com/netbox-community/netbox/commit/9aff7e710330418df2ca9fd747f64218f74a6cc2) Add order_alphanetically boolean for choice sets - [`1f5b583`](https://github.com/netbox-community/netbox/commit/1f5b58342563dc7ee277efe94b9db83a90633810) Introduce ArrayColumn for choice lists - [`feedf51`](https://github.com/netbox-community/netbox/commit/feedf516599610762a2f5046e6f448224fabd630) Show dependent custom fields on choice set view - [`00096cc`](https://github.com/netbox-community/netbox/commit/00096ccb2b3d2715087446fb553c49050feee392) Update custom fields documentation - [`ed2d78f`](https://github.com/netbox-community/netbox/commit/ed2d78fef4b02c728ee79b9b54ba899ca2ff5eb6) Introduce ArrayWidget for more convenient editing of choices ### 📊 Changes **32 files changed** (+792 additions, -150 deletions) <details> <summary>View changed files</summary> 📝 `docs/customization/custom-fields.md` (+1 -1) 📝 `docs/models/extras/customfield.md` (+2 -2) ➕ `docs/models/extras/customfieldchoiceset.md` (+17 -0) 📝 `netbox/extras/api/nested_serializers.py` (+9 -0) 📝 `netbox/extras/api/serializers.py` (+14 -1) 📝 `netbox/extras/api/urls.py` (+1 -0) 📝 `netbox/extras/api/views.py` (+7 -2) 📝 `netbox/extras/filtersets.py` (+38 -0) 📝 `netbox/extras/forms/bulk_edit.py` (+23 -2) 📝 `netbox/extras/forms/bulk_import.py` (+24 -6) 📝 `netbox/extras/forms/filtersets.py` (+18 -2) 📝 `netbox/extras/forms/model_forms.py` (+23 -3) 📝 `netbox/extras/graphql/schema.py` (+6 -0) 📝 `netbox/extras/graphql/types.py` (+9 -0) ➕ `netbox/extras/migrations/0096_customfieldchoiceset.py` (+61 -0) ➕ `netbox/extras/migrations/0097_customfield_remove_choices.py` (+17 -0) 📝 `netbox/extras/models/__init__.py` (+1 -1) 📝 `netbox/extras/models/customfields.py` (+71 -18) 📝 `netbox/extras/tables/tables.py` (+34 -0) 📝 `netbox/extras/tests/test_api.py` (+37 -2) _...and 12 more files_ </details> ### 📄 Description ### Fixes: #12988 - Introduce the new `CustomFieldChoiceSet` model - Automatically migrate all CF choices to the new model - Add a `choice_set` ForeignKey to `CustomField` and remove the `choices` array field - Introduce `ArrayWidget` to improve UX while editing choices --- <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:22:42 +01:00
adam closed this issue 2025-12-29 23:22:42 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#14128