Hi,

I meet a problem with ImageField when display the image it contains.


I defined an ImageField in myobject like this:
attachment = models.ImageField(upload_to='attachments')


I set the variables
#############
MEDIA_ROOT = 'c:/myproject/upload'
MEDIA_URL = 'http://127.0.0.1:8000/upload'
#############
in settings.py. And it succeed when uploading an attachment for an
object. The attachments were placed in folder
"c:/myproject/upload/attachments"


But when i was displaying the image, i did not get the right url of
attachment.
In my template, i put down
<td><a href="{{ myobject.get_attachment_url
}}">{{myobject.get_attachment_url}}</td>


Unfortunately, the variable  {{ myobject.get_attachment_url }} in
template did not return the right value. It returns like this,
"http://127.0.0.1:8000/attachments/0001.TIF";. But i expect
"http://127.0.0.1:8000/upload/attachments/0001.TIF";.

What is wrong with myobject.get_attachment_url? As if it did not use
MEDIA_URL in my settings. 


Thanks! 


Minglei Wang


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