﻿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
11196	dimensions not set when value for ImageField specifed in constructor	Gary Wilson	Gary Wilson	"Given a model with an `ImageField` and defined height/width fields, ex.

{{{
class Person(models.Model):
    name = models.CharField(max_length=50)
    mugshot = ImageField(storage=temp_storage, upload_to='tests',
                         height_field='mug_height', width_field='mug_width')
    mug_height = models.PositiveSmallIntegerField()
    mug_width = models.PositiveSmallIntegerField()
}}}

Dimensions fields aren't set if you do:
{{{
p = Person(name='Joe', mugshot=ImageFile(open(...)))
}}}

Actually, they are getting set when the `ImageField` gets the value assigned in `Model.__init__()` (using the `ImageFileDescriptor`), but since the height and width fields are defined after the `ImageField`, they get set back to `None` by `Model.__init__()`.

After calling save on the instance:
{{{
p.save()
}}}

...the dimensions fields are set because `save()` ends up calling `ImageFileDescriptor.__set__()`, which updates the dimensions fields.

This is related to #10044, #10404, and #11084."		closed	Database layer (models, ORM)	dev		fixed			Accepted	0	0	0	0	0	0
