Re: foreign key id as part of models.FileField(upload_to=...)

2009-03-14 Thread Christoph Wegscheider
On 14 Mrz., 22:42, Dirk Eschler wrote: > Am Samstag 14 März 2009 22:29:16 schrieb Dirk Eschler: > > > def get_img_storage_path(instance, filename): > >     return '%salbums/images/%s/' % (settings.MEDIA_ROOT, instance.album.pk) > > Forgot the filename in my example... > > def get_img_storage_pa

Re: foreign key id as part of models.FileField(upload_to=...)

2009-03-14 Thread Dirk Eschler
Am Samstag 14 März 2009 22:29:16 schrieb Dirk Eschler: > def get_img_storage_path(instance, filename): > return '%salbums/images/%s/' % (settings.MEDIA_ROOT, instance.album.pk) Forgot the filename in my example... def get_img_storage_path(instance, filename): return '%salbums/images/%s/%

Re: foreign key id as part of models.FileField(upload_to=...)

2009-03-14 Thread Dirk Eschler
Am Samstag 14 März 2009 22:13:39 schrieb Christoph Wegscheider: > Hi, > I want to upload photos to directories structured by the album primary > key. I have the following model: > > class Photo(models.Model): > album = models.ForeignKey(Album) > img = models.FileField(upload_to='albums/ima

Re: foreign key id as part of models.FileField(upload_to=...)

2009-03-14 Thread Alex Gaynor
On Sat, Mar 14, 2009 at 4:13 PM, Christoph Wegscheider < christoph.wegschei...@gmail.com> wrote: > > Hi, > I want to upload photos to directories structured by the album primary > key. I have the following model: > > class Photo(models.Model): >album = models.ForeignKey(Album) >img = model