Hello everybody, I want to create a gallery app and I have a slight problem, my models.py code looks like this:
... class Gallery(models.Model): slug = models.SlugField(...) ... class Image(models.Model): ... gallery = models.ForeignKey(...) image = models.ImageField( upload_to=(lambda:'images/%s' % gallery.slug), ...,) ... This won't work, because the ImageField constructor wants "upload_to" to be a String and no Funtion. The Problem is, I want a dynamic image storage path, something like MEDIA_ROOT+"images/" wont work with hundrets of galleries, I need something like MEDIA_ROOT +"images/"+gallery.slug . In my Image class "gallery" is a ForeignKey, which will have the attribute "slug" at runtime, but not at model creation time, either I am doing something stupid or there is currently no way to solve this. Hopefully someone knows a solution. Sascha Peilicke -- http://saschashideout.de --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---