[PR #13219] [MERGED] Closes #12194: Add pre-defined custom field choices #14134

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

📋 Pull Request Information

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

Base: featureHead: 12194-custom-field-locations


📝 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

27 files changed (+121940 additions, -100 deletions)

View changed files

📝 docs/models/extras/customfieldchoiceset.md (+12 -2)
📝 netbox/extras/api/serializers.py (+6 -2)
📝 netbox/extras/api/views.py (+21 -0)
📝 netbox/extras/choices.py (+13 -0)
netbox/extras/data/__init__.py (+9 -0)
netbox/extras/data/iata.py (+9768 -0)
netbox/extras/data/iso_3166.py (+253 -0)
netbox/extras/data/un_locode.py (+111557 -0)
📝 netbox/extras/filtersets.py (+1 -1)
📝 netbox/extras/forms/bulk_edit.py (+5 -1)
📝 netbox/extras/forms/bulk_import.py (+6 -1)
📝 netbox/extras/forms/filtersets.py (+9 -2)
📝 netbox/extras/forms/model_forms.py (+11 -5)
📝 netbox/extras/migrations/0096_customfieldchoiceset.py (+3 -2)
📝 netbox/extras/models/customfields.py (+47 -15)
📝 netbox/extras/tables/tables.py (+16 -12)
📝 netbox/extras/tests/test_api.py (+20 -4)
📝 netbox/extras/tests/test_changelog.py (+7 -7)
📝 netbox/extras/tests/test_customfields.py (+33 -21)
📝 netbox/extras/tests/test_forms.py (+2 -2)

...and 7 more files

📄 Description

Closes: #12194

  • Add base_choices field to CustomFieldChoiceSet
  • Populate choices for ISO 3166 and UN/LOCODE values
  • Introduce DynamicChoiceField and DynamicMultipleChoiceField to handle API-populated choice selections

🔄 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/13219 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 7/19/2023 **Status:** ✅ Merged **Merged:** 7/28/2023 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `12194-custom-field-locations` --- ### 📝 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 **27 files changed** (+121940 additions, -100 deletions) <details> <summary>View changed files</summary> 📝 `docs/models/extras/customfieldchoiceset.md` (+12 -2) 📝 `netbox/extras/api/serializers.py` (+6 -2) 📝 `netbox/extras/api/views.py` (+21 -0) 📝 `netbox/extras/choices.py` (+13 -0) ➕ `netbox/extras/data/__init__.py` (+9 -0) ➕ `netbox/extras/data/iata.py` (+9768 -0) ➕ `netbox/extras/data/iso_3166.py` (+253 -0) ➕ `netbox/extras/data/un_locode.py` (+111557 -0) 📝 `netbox/extras/filtersets.py` (+1 -1) 📝 `netbox/extras/forms/bulk_edit.py` (+5 -1) 📝 `netbox/extras/forms/bulk_import.py` (+6 -1) 📝 `netbox/extras/forms/filtersets.py` (+9 -2) 📝 `netbox/extras/forms/model_forms.py` (+11 -5) 📝 `netbox/extras/migrations/0096_customfieldchoiceset.py` (+3 -2) 📝 `netbox/extras/models/customfields.py` (+47 -15) 📝 `netbox/extras/tables/tables.py` (+16 -12) 📝 `netbox/extras/tests/test_api.py` (+20 -4) 📝 `netbox/extras/tests/test_changelog.py` (+7 -7) 📝 `netbox/extras/tests/test_customfields.py` (+33 -21) 📝 `netbox/extras/tests/test_forms.py` (+2 -2) _...and 7 more files_ </details> ### 📄 Description ### Closes: #12194 - Add `base_choices` field to `CustomFieldChoiceSet` - Populate choices for ISO 3166 and UN/LOCODE values - Introduce `DynamicChoiceField` and `DynamicMultipleChoiceField` to handle API-populated choice selections --- <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:44 +01:00
adam closed this issue 2025-12-29 23:22:44 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#14134