On 8/19/2010 12:29 PM, Bradley Hintze wrote:
> I am sorry. How does this 'Context' object(?) relate to displaying an
> image? Your last though me for a loop.
> 
The context is what provide the variables that become available for use
inside curly braces in the template. The render_to_response() function
allows you to provide additional context through its "context_instance"
argument. By creating a RequestContext form the request and passing it
to render_to_response() you ensure that MEDIA_URL is available to the
template.

regards
 Steve


> On Thu, Aug 19, 2010 at 12:11 PM, Javier Guerra Giraldez
> <jav...@guerrag.com> wrote:
>> On Thu, Aug 19, 2010 at 10:49 AM, Bradley Hintze
>> <bradle...@aggiemail.usu.edu> wrote:
>>> <img src = "duke-logo.jpg">
>>> ...
>>>
>>> so it looks as if you're right, the template isn't gettng the
>>> MEDIA_URL variable.
>>> I thought this was taken care of in setttings.py (see previous
>>> messages). Does something need to be done in url.py?
>>
>>
>> no, it's done on a context processor:
>> http://docs.djangoproject.com/en/1.2/ref/templates/api/#playing-with-context-objects
>>
>> most template-handling shortcuts and generic view automatically apply
>> the default set of context processors; but one notable exception is
>> render_to_response().  if you're using it, it's better to create the
>> context yourself as shown in the note:
>>
>> render_to_response('my_template.html',
>>                              my_data_dictionary,
>>                              context_instance=RequestContext(request))
>>
>>
>>
>> --
>> Javier
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, sendemail to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
> 
> 
> 


-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to