Wow... django docs can be so confusing...

I could not believe it worked just by using upper case MEDIA_URL

Thanks so much :) :)

I spent a day trying figure this out...

On 8 July, 13:14, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Jul 8, 12:57 pm, justin jools <justinjo...@gmail.com> wrote:
>
>
>
>
>
> > Thank for your quick response Daniel.
> > I'm just confused about using media_url with generic views, I have
> > done it previously with:
>
> > from django.conf import settings        # for media_url
> > media_url = settings.MEDIA_URL
>
> > def dblist(request):
> >     obj_list_menu = dbModel1.objects.all()
> >     return render_to_response('products/dblist.html', {'make_list':
> > obj_list_menu, 'media_url': media_url })
>
> > but with generic views, have no views.py obviously, so I put it in
> > settings.py:
>
> > from django.conf import settings        # for media_url
> > media_url = settings.MEDIA_URL
>
> > and in my base.html template:
>
> > {{ media_url }}css/base.css
>
> > but it's not picking it up?  do i need to pass it with generic views?
>
> But you don't need to set anything! As I said, generic views already
> have access to MEDIA_URL, as long as you don't remove it from the list
> of installed context processors. So I don't know why you want to
> define another variable called "media_url". Just use the existing
> upper-case one.
> --
> DR.- Hide quoted text -
>
> - Show quoted text -

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