[PR #18846] [MERGED] Fixes: #18557 Editing a Custom Field with Default Value does not pre-populate form with correct value #15455

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/18846
Author: @renatoalmeidaoliveira
Created: 3/8/2025
Status: Merged
Merged: 3/12/2025
Merged by: @arthanson

Base: mainHead: 18557-Edit-a-Custom-Field-with-Default-Value


📝 Commits (1)

  • a96d7c5 Change JSONField, prepare_value to output str with enclosing "

📊 Changes

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

View changed files

📝 netbox/utilities/forms/fields/fields.py (+1 -1)

📄 Description

Fixes: #18557 Editing a Custom Field with Default Value does not pre-populate form with correct value

  • JSONField from utilities.forms.fields writes strings as is, intead of enclosed by "
  • Change the behaviour of prepare_value to add the extra "

This issue also affects other fields like:

EventRule's Action data field

Doesn't find any other field that uses JSONField and stop working after the fix.


🔄 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/18846 **Author:** [@renatoalmeidaoliveira](https://github.com/renatoalmeidaoliveira) **Created:** 3/8/2025 **Status:** ✅ Merged **Merged:** 3/12/2025 **Merged by:** [@arthanson](https://github.com/arthanson) **Base:** `main` ← **Head:** `18557-Edit-a-Custom-Field-with-Default-Value` --- ### 📝 Commits (1) - [`a96d7c5`](https://github.com/netbox-community/netbox/commit/a96d7c52b5be53be95e119a9c061493bd879d53f) Change JSONField, prepare_value to output str with enclosing " ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `netbox/utilities/forms/fields/fields.py` (+1 -1) </details> ### 📄 Description ### Fixes: #18557 Editing a Custom Field with Default Value does not pre-populate form with correct value - `JSONField` from `utilities.forms.fields` writes strings as is, intead of enclosed by `"` - Change the behaviour of `prepare_value` to add the extra `"` This issue also affects other fields like: `EventRule`'s `Action data` field Doesn't find any other field that uses `JSONField` and stop working after the fix. --- <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:22:01 +01:00
adam closed this issue 2025-12-30 00:22:01 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15455