﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
1537	ImageField height_field and width_field does not update after changing the image	django@…	Adrian Holovaty	"=== Steps to reproduce the bug ===

1. Create a model with an ImageField {{{img}}}, specifying height_field and width_field options

2. Upload an image through Admin UI

3. Check {{{model_instance.img_width}}} and {{{model_instance.img_height}}}

4. Update the same object with another image of a different dimension through Admin UI

5. Note that {{{model_instance.img_width}}} and {{{model_instance.img_height}}} remain the same

Commenting out the following code from {{{django.core.meta.fields.ImageField}}} seems to have solved the problem, but not sure if I'm breaking something else:

{{{
    def save_file(self, new_data, new_object, original_object, change, rel):
        FileField.save_file(self, new_data, new_object, original_object, change, rel)
        # If the image has height and/or width field(s) and they haven't
        # changed, set the width and/or height field(s) back to their original
        # values.
        if change and (self.width_field or self.height_field):
            """"""
            if self.width_field:
                setattr(new_object, self.width_field, getattr(original_object, self.width_field))
            if self.height_field:
                setattr(new_object, self.height_field, getattr(original_object, self.height_field))
            """"""
            new_object.save()
}}}"	defect	closed	Core (Other)	magic-removal	major	fixed			Unreviewed	0	0	0	0	0	0
