[PR #16713] [MERGED] 16640 fix JSON custom field save nul #14895

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/16713
Author: @arthanson
Created: 6/24/2024
Status: Merged
Merged: 8/16/2024
Merged by: @jeremystretch

Base: developHead: 16640-custom-json-field


📝 Commits (4)

  • ada87aa 16640 fix JSON custom field save nul
  • 5107007 Merge branch 'develop' into 16640-custom-json-field
  • 1c380aa 16640 explicitly check against None
  • cb8fdbe 16640 convert JSON field from str to dict

📊 Changes

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

View changed files

📝 netbox/netbox/forms/base.py (+2 -0)

📄 Description

Fixes: #16640

This will fix new saves, doesn't go back and fix old values - could set it to UI editable and edit it to fix. If you have saved multiple times then it will keep escaping so not sure if more dangerous to auto-fix with a validate as JSON and if not valid then revert to ''...

It looks like as it is UI_EDITABLE = FALSE the field isn't getting converted in clean as a JSON field, this works if UI_EDITABLE = True and the field is returned as a dict, if it is not UI editable the fields get returned as a string.


🔄 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/16713 **Author:** [@arthanson](https://github.com/arthanson) **Created:** 6/24/2024 **Status:** ✅ Merged **Merged:** 8/16/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `16640-custom-json-field` --- ### 📝 Commits (4) - [`ada87aa`](https://github.com/netbox-community/netbox/commit/ada87aafce265ec39a7b14fa475523bdc6e4a81a) 16640 fix JSON custom field save nul - [`5107007`](https://github.com/netbox-community/netbox/commit/51070079e4b14b7b66dccc0650a036b0e21fd035) Merge branch 'develop' into 16640-custom-json-field - [`1c380aa`](https://github.com/netbox-community/netbox/commit/1c380aab98c9cc2c86f0d821bad693efc8b7678a) 16640 explicitly check against None - [`cb8fdbe`](https://github.com/netbox-community/netbox/commit/cb8fdbe40177f26d42bf2af70ef81d28b48a493f) 16640 convert JSON field from str to dict ### 📊 Changes **1 file changed** (+2 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `netbox/netbox/forms/base.py` (+2 -0) </details> ### 📄 Description ### Fixes: #16640 This will fix new saves, doesn't go back and fix old values - could set it to UI editable and edit it to fix. If you have saved multiple times then it will keep escaping so not sure if more dangerous to auto-fix with a validate as JSON and if not valid then revert to ''... It looks like as it is UI_EDITABLE = FALSE the field isn't getting converted in clean as a JSON field, this works if UI_EDITABLE = True and the field is returned as a dict, if it is not UI editable the fields get returned as a string. --- <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:27:20 +01:00
adam closed this issue 2025-12-29 23:27:20 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#14895