[Django] #36848: Documentation doesn't mention that BadRequest is handled by handler400

3 views
Skip to first unread message

Django

unread,
Jan 6, 2026, 11:58:48 PMJan 6
to django-...@googlegroups.com
#36848: Documentation doesn't mention that BadRequest is handled by handler400
-------------------------+------------------------------------------------
Reporter: Lincoln | Type: Cleanup/optimization
Status: new | Component: Documentation
Version: | 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
-------------------------+------------------------------------------------
A `BadRequest` exception raised in a view, is handled by the `handler400`
view (default `django.views.defaults.bad_request`).

https://github.com/django/django/blob/c68e4adea0703354508d51895b091771b1f6ac45/django/core/handlers/exception.py#L96-L104

Looking at the documentation, I can't see this link mentioned anywhere.

Places I looked:

* https://docs.djangoproject.com/en/dev/ref/views/#the-400-bad-request-
view (This section only mentions `SuspiciousOperation`)
* https://docs.djangoproject.com/en/dev/topics/http/views/#customizing-
error-views
* https://docs.djangoproject.com/en/dev/ref/urls/#handler400
* https://docs.djangoproject.com/en/dev/ref/exceptions/#badrequest

For comparison, This section about the 404 view

https://docs.djangoproject.com/en/dev/ref/views/#the-404-page-not-found-
view

explicitly says "When you raise Http404 from within a view, ..."
--
Ticket URL: <https://code.djangoproject.com/ticket/36848>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 7, 2026, 6:11:02 AMJan 7
to django-...@googlegroups.com
#36848: Documentation doesn't mention that BadRequest is handled by handler400
-------------------------------------+-------------------------------------
Reporter: Lincoln | Owner: Kundan
Type: | Yadav
Cleanup/optimization | Status: assigned
Component: Documentation | Version:
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Kundan Yadav):

* owner: (none) => Kundan Yadav
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36848#comment:1>

Django

unread,
Jan 7, 2026, 7:57:55 AMJan 7
to django-...@googlegroups.com
#36848: Documentation doesn't mention that BadRequest is handled by handler400
-------------------------------------+-------------------------------------
Reporter: Lincoln | Owner: Kundan
Type: | Yadav
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: handler400 | Triage Stage: Accepted
bad_request |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* keywords: => handler400 bad_request
* stage: Unreviewed => Accepted
* version: => dev

Comment:

Hello Lincoln! Thanks for the report.

While the current documentation already describes this behavior indirectly
(the `BadRequest` exception docs says they resul in an
`HttpResponseBadRequest` at the handler level with a status code of 400,
and `handler400` being responsible for rendering 400 responses), I agree
that an explicit mention similar to `Http404` would improve clarity.
Accepting this as a small documentation clarification.
--
Ticket URL: <https://code.djangoproject.com/ticket/36848#comment:2>

Django

unread,
Jan 7, 2026, 7:58:40 AMJan 7
to django-...@googlegroups.com
#36848: Documentation doesn't mention that BadRequest is handled by handler400
-------------------------------------+-------------------------------------
Reporter: Lincoln | Owner: Kundan
Type: | Yadav
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: handler400 | Triage Stage: Accepted
bad_request |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Natalia Bidart):

Kundan, just a quick suggestion regarding ticket assignments: while you
are getting started with Django contributions, it is usually best to focus
on one ticket at a time and see it through fully, including reviews and
any required follow-ups, before taking on additional tickets. This helps
keep tickets moving and avoids unintentionally blocking other
contributors. Thanks! and I appreciate the interest in contributing.
--
Ticket URL: <https://code.djangoproject.com/ticket/36848#comment:3>
Reply all
Reply to author
Forward
0 new messages