Adding images fails for edit-inline with width_field set
|Reported by:||nichyoung||Owned by:||adrian|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Adding an record containing an image using edit-inline fails with the error:
"$DJANGO_SRC/django/core/meta/fields.py", line 415, in save_file setattr(new_object, self.width_field, getattr(original_object, self.width_field)) AttributeError: 'NoneType' object has no attribute 'width'
(where the model I'm trying to add has an integer field width).
The image is correctly added to the database and filesystem with the correct height and width.
The problem appears to be in meta/__init__.py where the change variable for the parent table is used for the child table - thus the file saveing code is told that an original_object exists where it does not. Changing the save_file call use old_rel_obj is not None in place of change as in the attached patch fixes the problem.