1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

#12058: Fix initial JSON population

This commit is contained in:
jeremystretch
2023-03-28 10:00:15 -04:00
parent a2c7452f90
commit 7d64e5bc62

View File

@ -254,6 +254,15 @@ class ConfigContextForm(BootstrapMixin, forms.ModelForm):
'tenants', 'tags',
)
def __init__(self, *args, initial=None, **kwargs):
# Convert data delivered via initial data to JSON data
if initial and 'data' in initial:
if type(initial['data']) is str:
initial['data'] = json.loads(initial['data'])
super().__init__(*args, initial=initial, **kwargs)
class ImageAttachmentForm(BootstrapMixin, forms.ModelForm):