django-jsonform icon indicating copy to clipboard operation
django-jsonform copied to clipboard

Add schema support for `ArrayField`

Open ghost opened this issue 3 years ago • 2 comments

Looks like it's not implemented right now. Would love to have this supported. Thoughts?

ghost avatar Nov 07 '22 15:11 ghost

I'll have to think about this.

Meanwhile, you can override the schema using a custom form:

# models.py
class MyModel(...):
    my_array = ArrayField(...)


# forms.py
class MyModelForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # Provide custom schema
        self.fields['my_array'].widget.schema = {'type': 'array', ...}


# admin.py
class MyAdmin(admin.ModelAdmin):
    form = MyModelForm

...

bhch avatar Nov 07 '22 16:11 bhch

I am @ghost

dongyuzheng avatar Nov 11 '22 16:11 dongyuzheng