django-jsoneditor
django-jsoneditor copied to clipboard
Fixes issue #65: Allow overriding jsoneditor and ace editor options for individual fields
Fixes #65
This PR allows overriding either the default or project-level django_jsoneditor_init
and/or django_jsoneditor_ace_options
on a per-field basis.
Hello @GregKaleka,
I've made changes described in your version of README and got the following error:
File "/disk0/home/seva/swat/sgerp/jsoneditor/forms.py", line 50, in __init__
super().__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'init_options'
(django v.2.2.5)
You need to modify the __init__()
options and probably the render
method of the JSONEditor
to pass init_options
and ace_options
to the widget attributes in the rendered HTML. Notice that the attributes might be empty, so you need to ensure the proper value is passed before the JSON.parse()
call in the Javascript code.
@nnseva sorry about that! Looks like I neglected to check in the forms.py
changes. I installed this version into a project locally and it is working both with and without those arguments passed in.