Closed cyberbudy closed 4 years ago
I don’t get the form, is it due to a theme error, or am I mistaken somewhere? in the dev console i see:
Uncaught Error: Unknown theme bootstrap3 at new Z (jsoneditor.min.js:18) at (index):241
my code:
DATA_SCHEMA = {
'type': 'array',
"title": "Смета",
"format": "table",
"items": {
"type": "object",
"title": "Смета",
"properties": {
"name": {
'title': 'Критерий',
"type": "string"
},
"cost": {
"type": "number"
}
}
}
}
class ReportSmetaAdminForm(forms.ModelForm):
class Meta:
model = Report
fields = '__all__'
widgets = {
'smeta': JSONEditorWidget(DATA_SCHEMA, collapsed=False),
}
@admin.register(Report)
class ReportAdmin(admin.ModelAdmin):
list_display = ('project', 'status',)
form = ReportSmetaAdminForm
New json-editor does not support bootstrap 3 now. As workaround it is possible to use the html theme. I am going to update plugin to use bootstrap 4 as default.
how to use html theme?
It is possible to pass any options into JSONEditor via the editor_options parameter of JSONEditorWidget.
widget = JSONEditorWidget(schema, False, editor_options={'theme': 'html'})
@Gustik @cyberbudy check 0.2.3 version please. It uses bootstrap 4
thank you, it works!
When using default theme 'bootstrap3' I have an error in console "Unknown theme bootstrap3"