Here RequestContext only has the first argument filled i.e. request.
My questions are:
1. Is RequestContext(request) being used in a kind of dummy way to suck up the context processors for render_to_response?
2. What would render_to_response be doing if has both context_dict AND RequestContext had a second argument?
Sorry if these are stupid questions. I'm new to everything python and Dango, and the kind of person who forgets everything they have ever known when trying to decide which pack of toilet paper to buy in the supermarket.
Andy
Fred Stluka
unread,
Nov 15, 2013, 8:59:37 AM11/15/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Andy,
RequestContext is being passed in so that it become available
to the template, so that it can do things like {% csrf_token %}
which requires access to the session id.
I'm not sure what would happen if a dictionary were passed to
RequestContext as an optional 2nd argument. I've always
passed the dictionary directly to render_to_response().
--Fred
------------------------------------------------------------------------
Fred Stluka -- mailto:fr...@bristle.com -- http://bristle.com/~fred/ Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
------------------------------------------------------------------------
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
This is explained in the docs:
If you do not pass in a context, a Context will be created from the
dictionary passed in.
If you do pass in a context, the contents of the dictionary passed in
will be merged in to the context.