Skip to content

Commit

Permalink
16640 fix JSON custom field save nul (#16713)
Browse files Browse the repository at this point in the history
* 16640 fix JSON custom field save nul

* 16640 explicitly check against None

* 16640 convert JSON field from str to dict
  • Loading branch information
arthanson authored Aug 16, 2024
1 parent 277b703 commit c457f01
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions netbox/netbox/forms/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def clean(self):
if value in self.fields[cf_name].empty_values:
self.instance.custom_field_data[key] = None
else:
if customfield.type == CustomFieldTypeChoices.TYPE_JSON and type(value) is str:
value = json.loads(value)
self.instance.custom_field_data[key] = customfield.serialize(value)

return super().clean()
Expand Down

0 comments on commit c457f01

Please sign in to comment.