Hi,

Sorry if my question seems trivial, but I've looked around for an
answer and I'm really at loss...

I've got a simple model:

class Photo(models.Model):
    image_file = models.ImageField(_('image file'), upload_to='%s/
images/' % settings.MEDIA_ROOT)

But when I upload an image via the admin it saves the whole path into
'image_file' (e.g. '/home/blah/media/images/example.gif'). Shouldn't
it just save the relative path (e.g. 'images/example.gif')?

The problem is that if in a template I do:

<img src="{{ photo.imafe_file.url }}">

... it generates the following:

<img src="/home/blah/media/images/example.gif">

I'm using a fresh checkout of Django from today. I tested both on
windows and on a Linux server.

Thanks a lot,

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