James,
I use get_image_url and the src is still 'c:/django/site_media/
IMG_0394.JPG'. I think their is a property that I don't have
correct. Below is a list of properties that might be wrong
settings.py
MEDIA_ROOT = ''
MEDIA_URL = ''
////////////////////
urls.py
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': 'c:/django/site_media/', 'show_indexes': True}),
////////////////////
models.py
class members(models.Model):
title = models.CharField(maxlength=100)
names = models.CharField(maxlength=100)
theslug = models.SlugField(prepopulate_from=["names"])
email = models.EmailField()
city = models.CharField(maxlength=100)
state = models.USStateField()
image = models.ImageField(upload_to='c:/django/site_media/')
//////////////
members_detail.py
<img src="{{ thetabinfo.get_image_url }}" width="200" height="150" />
Thanks for any help
On May 8, 10:20 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 5/8/07, gsmith <[EMAIL PROTECTED]> wrote:
>
> > by using the following html '<img src="{{ thetabinfo.image }}"'.
> > However, this contains the string 'c:/django/site_media/image.jpg'.
>
> Use
>
> <img src="{{ thetabinfo.get_image_url }}" />
>
> The "get_FIELDNAME_url" method will return the URL of the file
> relative to MEDIA_ROOT, while just printing out the field value will
> return the filesystem location of the file. This is covered in the
> documentation:
>
> http://www.djangoproject.com/documentation/db-api/#get-foo-url
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---