Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#15083 closed (fixed)

TemplateResponse doesn't use custom per-request URLConf

Reported by: Russell Keith-Magee Owned by: nobody
Component: Generic views Version: 1.2
Severity: Keywords: blocker
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

via Sayane on django-dev mailing list:

There is a problem with TemplateResponse and request.urlconf. Custom urlconf is removed[1] before TemplateResponse is rendered. This means that any call to reverse() when rendering template will use default urlconf (from settings). This makes TemplateResponse useless when using custom urlconf.

[1] http://code.djangoproject.com/browser/django/trunk/django/core/handlers/base.py#L166

Change History (3)

comment:1 Changed 6 years ago by Russell Keith-Magee

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

I suspect the fix here will be to reorganize the logic so that the TemplateResponse is rendered before the URLConf is reset.

comment:2 Changed 6 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [15226]) Fixed #15083 -- Corrected the order of TemplateResponse middleware handling, ensuring that custom URLConfs are valid, and that ResponseMiddleware is invoked if the TemplateResponseMiddleware causes errors. Thanks to Sayane for the report.

comment:3 Changed 5 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

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