Skip to content

Conversation

strokirk
Copy link
Contributor

See: https://code.djangoproject.com/ticket/32807

This change prevents an exception from being raised during form rendering when a JSONField is missing from form data, bringing the behaviour of JSONField in line with other fields in this case. Specifically, a blank field is rendered, accompanied by a validation error if the field is required.

Thanks to @AlexHill for the initial patch.

This takes over where #13844 left off.

Ping @felixxm for review.

@github-actions
Copy link

Hello @strokirk! Thank you for your contribution 💪

As it's your first contribution be sure to check out the patch review checklist.

If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!

If you have any design or process questions then you can ask in the Django forum.

Welcome aboard ⛵️!

@felixxm felixxm changed the title Fixed #32807 -- Allowed JSONField.bound_data to handle None as data Fixed #32807 -- Fixed JSONField crash when redisplaying None values. Jun 25, 2021
Copy link
Member

@felixxm felixxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@strokirk Thanks 👍

@felixxm felixxm self-assigned this Jun 25, 2021
@felixxm
Copy link
Member

felixxm commented Jun 28, 2021

@strokirk Thanks 👍 Welcome aboard ⛵

@strokirk
Copy link
Contributor Author

Thanks! 🎉

@felixxm felixxm merged commit f5ea9aa into django:main Jun 28, 2021
@strokirk strokirk deleted the fix.32807.jsonfield-none branch June 28, 2021 09:58
laymonage added a commit to laymonage/django-jsonfield-backport that referenced this pull request Aug 21, 2021
laymonage added a commit to laymonage/django-jsonfield-backport that referenced this pull request Aug 21, 2021
laymonage added a commit to laymonage/django-jsonfield-backport that referenced this pull request Aug 21, 2021
laymonage added a commit to laymonage/django-jsonfield-backport that referenced this pull request Aug 21, 2021
laymonage added a commit to laymonage/django-jsonfield-backport that referenced this pull request Aug 21, 2021
laymonage added a commit to laymonage/django-jsonfield-backport that referenced this pull request Aug 21, 2021
laymonage added a commit to laymonage/django-jsonfield-backport that referenced this pull request Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants