On Fri, Nov 15, 2013 at 12:59 PM, Andrew Taylor <[email protected]> wrote:
>
>
> Hi,
>
> I've followed some example code which is is follows:
>
> def index(request):
>     context = RequestContext(request)
>     context_dict =  {'boldmessage': "I am from the context"}
>     return render_to_response('rango/index.html',context_dict, context)
>
> 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.
>

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.

https://docs.djangoproject.com/en/1.6/topics/http/shortcuts/#django.shortcuts.render_to_response

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1K_gQej9-_PXWd7Nsr8UvfZ7OZ-UmpHq9oDH7LfmhuT0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to