I'm trying to create a dynamic path for when my users upload images. It works something like this:
View:
photo = Photo(...)
photo.save()
photo.original.save(filename, content)
Model:
album = models.ForeignKey(Album)
original = models.ImageField(upload_to="photos/%s/o" % str(album.id), max_length=200)
But when I try to do this, Django says no way.
Exception Value:
'ForeignKey' object has no attribute 'id'
How can I access the model members of a ForeignKey object in this manner?
Thanks.