class Meta: model = Bounty fields = '__all__' widgets = { 'signup_form': JSONEditorWidget({ 'type': 'array', 'format': 'table' }, collapsed=False), 'report_form': JSONEditorWidget({ 'type': 'array', 'format': 'table' }, collapsed=False) }
def get_form(self, request, obj=None, **kwargs): widget = JSONEditorWidget(dynamic_schema, False) form = super().get_form(request, obj, widgets={'roles': widget}, **kwargs) return form
def get_form(self, request, obj=None, **kwargs): widget = JSONEditorWidget(dynamic_schema, collapsed=False) form = super().get_form(request, obj, widgets={"validation_json": widget}, **kwargs) return form
class Meta: model = Blueprint fields = '__all__' widgets = { 'structure': JSONEditorWidget(BLUEPRINT_SCHEMA, collapsed=False, sceditor=True), }
class Meta: model = JSONModel fields = '__all__' widgets = { 'data': JSONEditorWidget(DATA_SCHEMA, collapsed=False, sceditor=True), }
class BaseAdmin(GuardedModelAdmin): DICT_SCHEMA = { 'type': 'object', 'title': _('metadata'), } formfield_overrides = { HStoreField: { 'widget': JSONEditorWidget(DICT_SCHEMA) } }
def get_form(self, request, obj=None, **kwargs): widgets = { 'data': JSONEditorWidget( OTHER_DATA_SCHEMA, collapsed=False, editor_options = { 'disable_collapse': True, 'disable_edit_json': True, 'disable_properties': True, } ), } return super().get_form(request, obj, widgets=widgets, **kwargs)
def get_form(self, request, obj=None, **kwargs): if obj: schema_id = obj.schema.id schema = get_schema(schema_id) else: schema = {} widget = JSONEditorWidget(schema, False, True) form = super(JSONModelAdmin, self).get_form(request, obj, widgets={'data': widget}, **kwargs) return form
def get_form(self, request, obj=None, **kwargs): widget = JSONEditorWidget(get_product_option_json_editor_schema, collapsed=False) form = super().get_form(request, obj, widgets={'options': widget}, **kwargs) return form
def get_formset(self, request, obj=None, **kwargs): widgets = { 'related_data': JSONEditorWidget(RELATED_DATA_SCHEMA, False), } return super().get_formset(request, obj, widgets=widgets, **kwargs)
def formfield_for_dbfield(self, db_field, **kwargs): if db_field.name == 'translations': kwargs['widget'] = JSONEditorWidget( generate_translatable_schema(self.model), False) return super(TranslatableModelAdmin, self).formfield_for_dbfield(db_field, **kwargs)
class Meta: model = JSONModel fields = '__all__' widgets = { 'data': JSONEditorWidget(DATA_SCHEMA), }
class Meta: model = Place fields = '__all__' widgets = { 'info': JSONEditorWidget(PLACE_SCHEMA, collapsed=False), }
def get_form(self, request, obj=None, **kwargs): widgets = {'roles': JSONEditorWidget(HOST_ROLES_SCHEMA, False)} form = super().get_form(request, obj, widgets=widgets, **kwargs) return form
class Meta: widgets = { 'settings': JSONEditorWidget({}, collapsed=False), }