django - override save method - 'ImageFile' object has no attribute '_committed' -
i override save method below, , get_thumbnails , save sorl..
but error 'imagefile' object has no attribute '_committed'
class hotelphotos(models.model): hotel = models.foreignkey(hotel, related_name='photos') code = models.charfield(max_length=255) original = models.imagefield(upload_to="media") medium = models.imagefield(upload_to="media", null=true, editable=false) thumbnail = models.imagefield(upload_to="media", null=true, editable=false) def save(self, *args, **kwargs): super(hotelphotos, self).save(*args, **kwargs) self.medium = get_thumbnail(self.original, '100x100', crop='center', quality=99) self.thumbnail = get_thumbnail(self.original, '50x50', crop='center', quality=99) super(hotelphotos, self).save(*args, **kwargs)
any ideas ?
self.thumbnail = get_thumbnail(self.original, '50x50', crop='center', quality=99).url
solved problem ..
Comments
Post a Comment