Re: Django ImageField url not relative to MEDIA_ROOT

2009-04-17 Thread Christian Berg
Hello! The ImageField and FileField URLs are relative to MEDIA_URL It's important to skip the leading slash, and add an slash to the end of the path Attribute. example: image = models.Imagefield(path="images/") In the Template use {{MEDIA_URL}}{{image.url}} On Fri, 17 Apr 2009 08:00:39 -0700

Re: Django ImageField url not relative to MEDIA_ROOT

2009-04-17 Thread SashaN
I'm hitting same problem. It seems to me it is a bug in django. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe

Re: Django ImageField url not relative to MEDIA_ROOT

2009-04-02 Thread pielgrzym
Thanks to pagenoare on #django-pl there is some progress: If I create a modelform, and instead of manually invoking model instance and saving it, I just do: new_image = form.save() Things work like expected. Why? :) On 2 Kwi, 12:18, pielgrzym wrote: > Hi there, > > Before explanation here is

Django ImageField url not relative to MEDIA_ROOT

2009-04-02 Thread pielgrzym
Hi there, Before explanation here is the link to problematic code: http://wklej.org/hash/968a35feef/ If one creates a model with imageField and uses it via admin everything is just fine - model instances have the image field with correct url: photo = Image.objects.get(pk=1) photo.image.url '/m