Django Admin: JSONField default empty dict wont save in admin

前端 未结 4 1755
一向
一向 2021-02-19 11:42

in my model defn i have

from django.contrib.postgres.fields import JSONField
.....
.......
.........

media_data=JSONField(default=dict)

I crea

4条回答
  •  -上瘾入骨i
    2021-02-19 12:08

    i have similar problem previously. adding required=False in your form field will solve the problem.

    class YourForm(forms.ModelForm):
        media_data = SimpleArrayField(JSONField(), required=False, widget=forms.Textarea, delimiter='|')
    

提交回复
热议问题