I have a model with an imagefield, and some fields that are computed
from the image. I'm trying to override the "save" method to fill in
the other fields.

When I test this in the admin, there are two problems: first, the path
(mymodel.image.path) doesn't honor the upload_to setting on the field.
It concats MEDIA_ROOT and the file name, w/o the upload_to. (This is
django 1.2.3). Second, I don't see the file in the filesystem when
.save() is called. Perhaps save() is the wrong place to do this?

If I don't try to generated the computed fields, the file is created
in the correct (upload_to) directory, and if I read the object from
the db, mymodel.image.path is also correct.

Looks like upload_to is only accessed during FieldFile.save(), where
the self.name is updated, so the path is always wrong before that.

And apparently the file isn't committed to storage until the field is
saved. Is there some other way to access the file before it is saved?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to