django-admin-json-editor icon indicating copy to clipboard operation
django-admin-json-editor copied to clipboard

Json editor in StackedInline

Open Fercho191 opened this issue 7 years ago • 2 comments

Hello! Thanks for the work in this repository, it works great!

I had a problem and I did not know how to fix it:

I tried to place the form in an admin.StackedInline, then add it to an admin.ModelAdmin

the template worked correctly with the schema, however, sending the form caused error because the field was in None.

class AnotherModelAdminForm(ModelForm):
    class Meta:
        model = AnotherModel
        fields = '__all__'
        widgets = {
            'json_field': JSONEditorWidget(SCHEMA, collapsed=False),
        }
class AnotherModelAdmin(admin.StackedInline):
    model = AnotherModel
    form = AnotherModelAdminForm

@admin.register(MyModel)
class MyModelAdmin(admin.ModelAdmin):
    inlines = [
        AnotherModelAdmin,
    ]

Can you think of a solution?

Thanks in advance

Fercho191 avatar Oct 03 '17 18:10 Fercho191

Hello. Thanks for your words! There is problem with js during binding editor. I will try to solve this and, if I succeed, I will add an example.

Thanks for the issue.

abogushov avatar Oct 05 '17 03:10 abogushov

Hello. Thanks for your words! There is problem with js during binding editor. I will try to solve this and, if I succeed, I will add an example.

Thanks for the issue.

Has this problem been solved yet? Thanks

linhfishCR7 avatar Jan 18 '23 05:01 linhfishCR7