Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#22167 closed Cleanup/optimization (fixed)

docs about order of template context processors unclear

Reported by: anonymous Owned by: Sasha Romijn
Component: Documentation Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If I do:

return render_to_response('my_template.html',
                              my_data_dictionary,
                              context_instance=RequestContext(request))

then my_data_dictionary will override anything added by the context processors.

The docs state:

"When you use RequestContext, the variables you supply directly are added first, followed any variables supplied by context processors. This means that a context processor may overwrite a variable you’ve supplied"

Which seems to relate to this situation:

return render_to_response('my_template.html',
                              context_instance=RequestContext(request, my_data_dictionary))

This seems inconsistent, could there be an extra note added to clarify what happens when my_data_dictionary is passed to render_to_response instead of RequestContext?

Change History (9)

comment:1 by Tim Graham, 10 years ago

Component: Template systemDocumentation
Triage Stage: UnreviewedAccepted

comment:2 by anonymous, 10 years ago

Owner: changed from nobody to anonymous
Status: newassigned

comment:3 by tibidat, 10 years ago

Owner: changed from anonymous to tibidat

Doing this during the DjangoConEu 2014 Sprints.

comment:5 by Sasha Romijn, 10 years ago

Owner: changed from tibidat to Sasha Romijn

comment:6 by Erik Romijn <eromijn@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In e7ffba8f78849fbf60b98fb8d67ef4577b585e3b:

Fixed #22167 -- Improved documentation on context processors

Clarified the explanation on the order in which user provided variables
to render_to_response, RequestContext and context processors are
loaded.

comment:7 by Erik Romijn <eromijn@…>, 10 years ago

In bd45139d4e17304229da5464c907c614e64278d1:

[1.7.x] Fixed #22167 -- Improved documentation on context processors

Backport of e7ffba8f78849fbf60b98fb8d67ef4577b585e3b from master.

comment:8 by Erik Romijn <eromijn@…>, 10 years ago

In 20215f4cae4f69f2bcbc4bbdbcd84651bee64634:

[1.6.x] Fixed #22167 -- Improved documentation on context processors

Backport of e7ffba8f78849fbf60b98fb8d67ef4577b585e3b from master.

comment:9 by Erik Romijn <eromijn@…>, 10 years ago

In 220c09e97acb8ca4267a0b754256e522e008c2d8:

[1.5.x] Fixed #22167 -- Improved documentation on context processors

Backport of e7ffba8f78849fbf60b98fb8d67ef4577b585e3b from master.

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