Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add schema support for ArrayField #72

Open
ghost opened this issue Nov 7, 2022 · 2 comments
Open

Add schema support for ArrayField #72

ghost opened this issue Nov 7, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Nov 7, 2022

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

@bhch bhch added the enhancement New feature or request label Nov 7, 2022
@ghost ghost changed the title [Feature request] Schema support for ArrayField Add schema support for ArrayField Nov 7, 2022
@bhch
Copy link
Owner

bhch commented Nov 7, 2022

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

...

@dongyuzheng
Copy link

I am @ghost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants