Opened 25 hours ago
Last modified 10 hours ago
#36848 assigned Cleanup/optimization
Documentation doesn't directly mention that BadRequest is handled by handler400
| Reported by: | Lincoln | Owned by: | Kundan Yadav |
|---|---|---|---|
| Component: | Documentation | Version: | dev |
| Severity: | Normal | Keywords: | handler400 bad_request |
| Cc: | Lincoln | Triage Stage: | Accepted |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
A BadRequest exception raised in a view, is handled by the handler400 view (default django.views.defaults.bad_request).
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, ..."
Change History (5)
comment:1 by , 18 hours ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
comment:2 by , 17 hours ago
| Keywords: | handler400 bad_request added |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
| Version: | → dev |
comment:3 by , 17 hours ago
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.
comment:4 by , 17 hours ago
| Summary: | Documentation doesn't mention that BadRequest is handled by handler400 → Documentation doesn't directly mention that BadRequest is handled by handler400 |
|---|
Hello Lincoln! Thanks for the report.
While the current documentation already describes this behavior indirectly (the
BadRequestexception docs says they resul in anHttpResponseBadRequestat the handler level with a status code of 400, andhandler400being responsible for rendering 400 responses), I agree that an explicit mention similar toHttp404would improve clarity. Accepting this as a small documentation clarification.