Re: inline formsets with FileField/ImageField and missing instance pk value for upload_to

2009-05-05 Thread skam
Sorry about that, it was better to post to django-users instead. I was saving the object first using create() manager method, that's why it was working well. Maybe I need to attach a function to the post_save signal to move the file over the custom path with the pk value. --~--~-~--~~-

Re: inline formsets with FileField/ImageField and missing instance pk value for upload_to

2009-05-04 Thread skam
On 4 Mag, 20:02, Karen Tracey wrote: > I don't understand how this could have worked under 1.0.2 (and don't have > time to test at the moment) since the doc for upload to has always included > this note: I know that note but it I tried to use upload_to as described above (but with ModelForms) an

Re: inline formsets with FileField/ImageField and missing instance pk value for upload_to

2009-05-04 Thread Karen Tracey
On Mon, May 4, 2009 at 1:26 PM, skam wrote: > > I am using inline formsets to save multiple "Photo" models related > with "Company" model, but "Photo" instance's pk is set to None. I need > it to set the upload directory and filename using the pk value: > > Sample model: > > def get_photo_image_

inline formsets with FileField/ImageField and missing instance pk value for upload_to

2009-05-04 Thread skam
I am using inline formsets to save multiple "Photo" models related with "Company" model, but "Photo" instance's pk is set to None. I need it to set the upload directory and filename using the pk value: Sample model: def get_photo_image_path(instance, filename): filename = '%s%s' % (instance