On 18 July 2011 02:04, galgal <weglarek.rob...@gmail.com> wrote:

> def upload_path_handler(instance, filename):
>
> return filename
>
> class SpectacleGallery(models.Model):
>
>  image = models.ImageField(upload_to=upload_path_handler)
>
> def save(self, *args, **kwargs):
>
>  Image.open(self.image)
>
>  super(SpectacleGallery, self).save(*args, **kwargs)
>
>  When I try to open it I get:
>
> IOError at /admin/index/spectacle/1/
> cannot identify image file
>
>
You should be able to pass SpectacleGallery.image to PIL open - I've done
similar things in the path.

What happens when you step through the code - what's the value of
self.image? Is it really a valid image file? Is it where it thinks it is?

Malcolm

-- 
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