#27697: JSONField with blank=True is rendered as non-required field in a ModelForm --------------------------------------------+-------------------------- Reporter: aruseni | Owner: (none) Type: Bug | Status: new Component: contrib.postgres | Version: 1.10 Severity: Normal | Keywords: postgres Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | --------------------------------------------+-------------------------- Try adding a JSONField with blank=True and without null=True to your model, and then use this model in the admin, the field will be rendered as a non-required field, and if you specify {} as the value, everything saves just fine.
If you don’t specify any value though, an error occurs: {{{ null value in column "json" violates not-null constraint }}} If you just use a zero-configuration JSONField without blank=True, then the form will not validate when an empty dictionary is specified. -- Ticket URL: <https://code.djangoproject.com/ticket/27697> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/050.db8ced558751675355b1528645ca3999%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.