#33130: ErrorDict doesn't pass the dict type check in JsonResponse
--------------------------------------+------------------------
Reporter: Jaap Roes | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------+------------------------
Just ran the test suite of a project on Django 4.0a1 (with Python 3.8) and
ran into the following issue:
We have a fairly simple `FormView` that defines the following
`form_invalid` method:
{{{
def form_invalid(self, form):
return JsonResponse(form.errors, status=400)
}}}
This worked fine before, but with Django 4 this raises the following
error:
`TypeError: In order to allow non-dict objects to be serialized set the
safe parameter to False.`
Wrapping `form.errors` with `dict()` fixes this, but I'm not sure this
should be necessary.
--
Ticket URL: <https://code.djangoproject.com/ticket/33130>
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/048.151bf6c9a9d817e82b56ddd07aa3b472%40djangoproject.com.