Ticket #8208: imagefieldfile.diff

File imagefieldfile.diff, 1009 bytes (added by vicvicvic, 7 years ago)

Patch for ImageField

  • django/db/models/fields/files.py

     
    273273            )
    274274            content = ContentFile(content)
    275275
     276        super(ImageFieldFile, self).save(name, content, save)
     277       
    276278        # Repopulate the image dimension cache.
    277         self._dimensions_cache = get_image_dimensions(content)
     279        self._dimensions_cache = get_image_dimensions(getattr(self.instance, self.field.name))
    278280       
    279281        # Update width/height fields, if needed
    280282        if self.field.width_field:
    281283            setattr(self.instance, self.field.width_field, self.width)
    282284        if self.field.height_field:
    283285            setattr(self.instance, self.field.height_field, self.height)
    284        
    285         super(ImageFieldFile, self).save(name, content, save)
    286286
    287287    def delete(self, save=True):
    288288        # Clear the image dimensions cache
Back to Top