Opened 12 years ago

Closed 12 years ago

#17949 closed Bug (invalid)

context_instance and authentication issue?

Reported by: februaryleung Owned by: nobody
Component: Uncategorized Version: 1.3
Severity: Normal Keywords: authentication
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

if you use this code:
return render_to_response('template',{'user':'something'},context_instance = RequestContext(request))
all the template can't use request.user object because {'user':'somethine'},also so, can't use user.is_authenticated method in template!

is it bug?

Change History (1)

comment:1 by Ramiro Morales, 12 years ago

Resolution: invalid
Status: newclosed

No, the dictionary parameter in

render_to_response(template_name[, dictionary][, context_instance][, mimetype])

is precisely provided as a way to actually override values in the context_instance, addition of these values is performed with a dict.update() call so similarly named keys are replaced. See https://docs.djangoproject.com/en/dev//topics/http/shortcuts/#render-to-response

Please for future post this kind doubts of to the mailing list or the IRC channel. And if you think you actually have a valid problem report to open a ticket, use the Preview button to make sure you description is actually readable, if it is hard to read to you, the same will happen to others. Using wiki markup helps a lot

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