[PR #18631] [MERGED] Fixes: #17796 Custom Field Choices -> Create & Add Another causes IndexError #15400

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/18631
Author: @renatoalmeidaoliveira
Created: 2/12/2025
Status: Merged
Merged: 2/25/2025
Merged by: @arthanson

Base: mainHead: 17796-Custom_Field_Choices_Create_Add_Another


📝 Commits (4)

  • e15638f Change init of CustomFieldChoiceSetForm to setup extra_choices
  • 734468f Fix Edit use case
  • dcdaa0e Add TODO comments
  • 4cd306f Fix comments

📊 Changes

1 file changed (+19 additions, -5 deletions)

View changed files

📝 netbox/extras/forms/model_forms.py (+19 -5)

📄 Description

Fixes: #17796 Custom Field Choices -> Create & Add Another causes IndexError

  • In the current release this issue doesn't raises an Exception, but setups a wrong vaule to the form after clicking in Create & Add Another
  • The fix consists in convert the array query into a string to fit the Form field that is an CharField
  • It should be possible to change the behaiviour of prepare_cloned_fields, but IMO that may lead to unwanted collateral effects, and its leads to a more complex solution

🔄 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/18631 **Author:** [@renatoalmeidaoliveira](https://github.com/renatoalmeidaoliveira) **Created:** 2/12/2025 **Status:** ✅ Merged **Merged:** 2/25/2025 **Merged by:** [@arthanson](https://github.com/arthanson) **Base:** `main` ← **Head:** `17796-Custom_Field_Choices_Create_Add_Another` --- ### 📝 Commits (4) - [`e15638f`](https://github.com/netbox-community/netbox/commit/e15638f7bef26b204c6a58f0f3dc70362c782330) Change __init__ of CustomFieldChoiceSetForm to setup extra_choices - [`734468f`](https://github.com/netbox-community/netbox/commit/734468fb996cc4b47e37ecf0e01282ea3b74bc0d) Fix Edit use case - [`dcdaa0e`](https://github.com/netbox-community/netbox/commit/dcdaa0ec71d4b5155c7ed5161676f381a324a3d8) Add TODO comments - [`4cd306f`](https://github.com/netbox-community/netbox/commit/4cd306f6f484a26ca6822cc47b6774636aedf317) Fix comments ### 📊 Changes **1 file changed** (+19 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/forms/model_forms.py` (+19 -5) </details> ### 📄 Description ### Fixes: #17796 Custom Field Choices -> Create & Add Another causes IndexError * In the current release this issue doesn't raises an Exception, but setups a wrong vaule to the form after clicking in Create & Add Another * The fix consists in convert the array query into a string to fit the Form field that is an CharField * It should be possible to change the behaiviour of prepare_cloned_fields, but IMO that may lead to unwanted collateral effects, and its leads to a more complex solution --- <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:21:42 +01:00
adam closed this issue 2025-12-30 00:21:43 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15400