Replying to myself, in case anyone else runs into this.  The problem,
well, cause of frustration was in the way that get_FIELD_url()
constructs it's return call.  It uses urlparse.urljoin to join MEDIA_URL
to the upload_to path.  When MEDIA_URL does not end in a slash, urljoin
strips off the final component.

NRY

On Thu, 2006-11-30 at 11:30 -0500, Nathan R. Yergler wrote:
> I'm using an ImageField in my model, and am having problems with the
> get_FOO_url() functionality.
> 
> For example, with a model such as:
> 
> class MyModel(models.Model):
> 
>    headshot = models.ImageField(upload_to='uploads/foo')
> 
> and the following in settings.py:
> 
> MEDIA_ROOT='/home/user/myproject/media'
> MEDIA_URL='http://localhost:8000/media-root'
> 
> (where the /media-root/ path is served by the Django static file generic
> view)
> 
> My understanding of the documentation is that calling
> modelInstance.get_headshot_url() should return something like
> 'http://localhost:8000/media-root/uploads/foo/filename.jpg'.  Instead I
> get 'http://localhost:8000/uploads/foo/filename.jpg'
> 
> Note that get_headshot_filename() works as expected
> (/home/user/myproject/media/uploads/foo/filename.jpg).
> 
> Am I missing something in the docs?  Well, I assume I am, but just
> haven't been able to figure it out.
> 
> Thanks
> 
> Nathan
> 
> 
> 
> > 


--~--~---------~--~----~------------~-------~--~----~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to