Opened 3 months ago

Closed 3 months ago

#33702 closed New feature (wontfix)

Make request available to custom 500 and 400 templates

Reported by: Andrew Owned by: Andrew
Component: HTTP handling Version: 4.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The problem occurs when rendering views.defaults.server_error with template, which is using some request - based markup. The request variable in template is just empty

Change History (5)

comment:1 Changed 3 months ago by Andrew

Easy pickings: set
Owner: changed from nobody to Andrew
Status: newassigned

comment:2 Changed 3 months ago by Andrew

Has patch: set

comment:3 Changed 3 months ago by Tim Graham

Component: Generic viewsHTTP handling
Summary: Custom 500 page is brokenMake request available to custom 500 and 404 templates
Type: UncategorizedNew feature

comment:4 Changed 3 months ago by Andrew

Summary: Make request available to custom 500 and 404 templatesMake request available to custom 500 and 400 templates

comment:5 Changed 3 months ago by Mariusz Felisiak

Has patch: unset
Resolution: wontfix
Status: assignedclosed

Django deliberately doesn't pass a request objects when rendering 400 and 500 error pages. It's recommended to keep them as simple as possible and don't e.g. interact with the database (see #22011) or do anything that might cause further errors. You can always customize error views in your app and pass a request objects to templates, but my advise is to avoid it.

You can also start a discussion on DevelopersMailingList if you don't agree.

Note: See TracTickets for help on using tickets.
Back to Top