On Wed, 2006-05-17 at 07:20 +0000, wegen wrote: > hi, all. > > i'm new to django and i have a couple of questions regarding images > upload in django. > > i followed the step-by-step instruction given in the FAQ of the django > homepage > (http://www.djangoproject.com/documentation/faq/#how-do-i-use-image-and-file-fields), > however, it does not seem to work and i just can't figure out why. > > i changed the MEDIA_ROOT and MEDIA_URL in the settings and set > ImageField in my model, and when i tried to view the image via one of > my templates by {{ object.get_xxx_url }} all i get is an empty page. > > could anyone please give me an example of doing this? > > my setting is as the following; > 1. i store all car images in /blahblah/media/images/cars/. > 2. in settings.py; > MEDIA_ROOT = '/blahblah/media/' > MEDIA_URL = 'http://localhost:8080/media/' > 3. in models.py; > carimage = models.ImageField(upload_to = 'images/cars/%s' % carID, null > = True, blank = True) > 4. in cardetails.html (i.e. template) > <img src = '{{ object.get_carimage_url }}'> > > thanks very much for your time.
A first step at debugging this would be to see what the value returned from object.get_carimage_url is. Either by viewing the source or by just dumping it into the template temporarily. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" 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-developers -~----------~----~----~----~------~----~------~--~---
