Hi all I'm trying to use the value of a foreignkey as an input to the "upload_to" path of an image field (note I'm using ImageWithThumbnailField and it works properly when upload_to='Images/'). But i can't seem to form a proper string to enter. The images load into folders with names such as: <django.db.models.fields.related.ForeignKey object at 0xe2cee30> When all I want is something like: Gallery1 (i.e. if the foreign key equals "Gallery1") My model looks something like this: def imageGalleryPath(self): a = self ### I'm uncertain what to write here, this gives folder mentioned above return "%s/" % (a) class Gallery(models.Model): ImageGalleryName = models.CharField(maxlength=200, core=True) def __str__(self): return self.ImageGalleryName class Admin: pass class GalleryImage(models.Model): gallery = models.ForeignKey(Gallery, verbose_name="Gallery", core=True) galleryimage = ImageWithThumbnailField(upload_to=imageGalleryPath(gallery), thumb_field='thumb', thumb_size=(200,150)) thumb = models.ImageField(upload_to='Thumbs/', blank=True, editable=False) def __str__(self): return self.galleryimage class Admin: pass Thanks Mark --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~--- |