I've add an attribute to the JSONEditorWidget, which allows users to choose the default rendering mode. This also solve the issue #2 .
from django import forms
from django_json_widget.widgets import JSONEditorWidget
from .models import YourModel
class YourForm(forms.ModelForm):
class Meta:
model = YourModel
fields = ('jsonfield',)
widgets = {
# choose one mode from ['text', 'code', 'tree', 'form', 'view']
'jsonfield': JSONEditorWidget(mode='code')
}
I've add an attribute to the
JSONEditorWidget
, which allows users to choose the default rendering mode. This also solve the issue #2 .