The 2 methods of using media_url with generic views I have tried:

1. 
http://www.b-list.org/weblog/2006/jun/14/django-tips-template-context-processors/
This knocked out my admin, but media_url did work

2. using templatetags
yourApp/templatetags/media_url.py:

from django.template import Library
from yourapp.settings import MEDIA_URL
register = Library()

@register.simple_tag
def media_url():
    return MEDIA_URL
And in my template file:

{% load media_url %}
<link href="{{ media_url }}css/main.css" rel="stylesheet" type="text/
css">

I could not get either of these methods to work, can you give best
guideline for this,

Thanks,
Justin Jools

On 8 July, 12:35, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Jul 8, 11:40 am, justin jools <justinjo...@gmail.com> wrote:
>
> > Thanks for that. I did read something about having to add services
> > back in to the context processors.
> > The reason I am doing this way is because I could not pass the {media
> > url} with generic views.
> > I did a search for trying to do this and hit a couple of posts saying
> > it is not possible to use {media url} with generic views.
>
> > If you have a solution I would be happy to hear this.
>
> I'd be interested to know where you read this, because in fact the
> opposite is true. Generic views all use the RequestContext, which
> means they automatically gain access to all the existing context
> processors - including the default
> "django.core.context_processors.media" processor. So, all generic
> views *already* have access to MEDIA_URL.
> --
> DR.

-- 
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