[PR #8090] [MERGED] Closes #8054: Configurable choice fields #13314

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/8090
Author: @jeremystretch
Created: 12/16/2021
Status: Merged
Merged: 12/16/2021
Merged by: @jeremystretch

Base: featureHead: 8054-configurable-choice-fields


📝 Commits (5)

  • 419f86a #8054: Support configurable status choices
  • 0d3b50a Support CSS class definition directly in CHOICES iterable
  • 1243029 Support nested choice groups
  • 1902ecb Drop as_dict() method from ChoiceSet
  • d8be8e2 ChoiceSet cleanup

📊 Changes

23 files changed (+197 additions, -249 deletions)

View changed files

📝 docs/configuration/optional-settings.md (+35 -0)
📝 netbox/circuits/choices.py (+9 -17)
📝 netbox/circuits/models/circuits.py (+1 -1)
📝 netbox/dcim/choices.py (+38 -78)
📝 netbox/dcim/models/cables.py (+1 -1)
📝 netbox/dcim/models/devices.py (+1 -1)
📝 netbox/dcim/models/power.py (+2 -2)
📝 netbox/dcim/models/racks.py (+1 -1)
📝 netbox/dcim/models/sites.py (+1 -1)
📝 netbox/extras/choices.py (+12 -33)
📝 netbox/extras/models/change_logging.py (+1 -1)
📝 netbox/extras/models/models.py (+1 -1)
📝 netbox/extras/reports.py (+2 -2)
📝 netbox/extras/templatetags/log_levels.py (+2 -2)
📝 netbox/ipam/choices.py (+34 -68)
📝 netbox/ipam/models/ip.py (+4 -4)
📝 netbox/ipam/models/vlans.py (+1 -1)
📝 netbox/netbox/settings.py (+1 -0)
📝 netbox/utilities/choices.py (+39 -11)
📝 netbox/utilities/tests/test_choices.py (+0 -5)

...and 3 more files

📄 Description

Closes: #8054

  • Introduce the FIELD_CHOICES configuration parameter
  • Extend the ChoiceSet class to automatically populate configured choices from the config
  • Move CSS class definitions into the CHOICES list

While this technically fills the feature request, the complete implementation should allow users to specify arbitrary colors (e.g. red, green, or blue) rather than BS5 theme classes (e.g. primary, success, info, etc.). I've opened #8089 to address that, as its scope extends beyond just the configurable choice 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/8090 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 12/16/2021 **Status:** ✅ Merged **Merged:** 12/16/2021 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `8054-configurable-choice-fields` --- ### 📝 Commits (5) - [`419f86a`](https://github.com/netbox-community/netbox/commit/419f86a4a5efbfa18c5cf8cb722d8c4bc2c29fbc) #8054: Support configurable status choices - [`0d3b50a`](https://github.com/netbox-community/netbox/commit/0d3b50a5e50ad218bfac1ede0c8559682cb7b384) Support CSS class definition directly in CHOICES iterable - [`1243029`](https://github.com/netbox-community/netbox/commit/124302908a1889549a896e7ed818af85f9bde79d) Support nested choice groups - [`1902ecb`](https://github.com/netbox-community/netbox/commit/1902ecb8ca92c6a80b3113ba01770dd2078c6400) Drop as_dict() method from ChoiceSet - [`d8be8e2`](https://github.com/netbox-community/netbox/commit/d8be8e25a53d1484b6ffb601bfae8c4ac0b77192) ChoiceSet cleanup ### 📊 Changes **23 files changed** (+197 additions, -249 deletions) <details> <summary>View changed files</summary> 📝 `docs/configuration/optional-settings.md` (+35 -0) 📝 `netbox/circuits/choices.py` (+9 -17) 📝 `netbox/circuits/models/circuits.py` (+1 -1) 📝 `netbox/dcim/choices.py` (+38 -78) 📝 `netbox/dcim/models/cables.py` (+1 -1) 📝 `netbox/dcim/models/devices.py` (+1 -1) 📝 `netbox/dcim/models/power.py` (+2 -2) 📝 `netbox/dcim/models/racks.py` (+1 -1) 📝 `netbox/dcim/models/sites.py` (+1 -1) 📝 `netbox/extras/choices.py` (+12 -33) 📝 `netbox/extras/models/change_logging.py` (+1 -1) 📝 `netbox/extras/models/models.py` (+1 -1) 📝 `netbox/extras/reports.py` (+2 -2) 📝 `netbox/extras/templatetags/log_levels.py` (+2 -2) 📝 `netbox/ipam/choices.py` (+34 -68) 📝 `netbox/ipam/models/ip.py` (+4 -4) 📝 `netbox/ipam/models/vlans.py` (+1 -1) 📝 `netbox/netbox/settings.py` (+1 -0) 📝 `netbox/utilities/choices.py` (+39 -11) 📝 `netbox/utilities/tests/test_choices.py` (+0 -5) _...and 3 more files_ </details> ### 📄 Description ### Closes: #8054 - Introduce the `FIELD_CHOICES` configuration parameter - Extend the ChoiceSet class to automatically populate configured choices from the config - Move CSS class definitions into the `CHOICES` list While this technically fills the feature request, the complete implementation should allow users to specify arbitrary colors (e.g. red, green, or blue) rather than BS5 theme classes (e.g. primary, success, info, etc.). I've opened #8089 to address that, as its scope extends beyond just the configurable choice 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-29 22:26:42 +01:00
adam closed this issue 2025-12-29 22:26: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#13314