#312 closed defect (fixed)
Adding images fails for edit-inline with width_field set
| Reported by: | nichyoung | Owned by: | Adrian Holovaty |
|---|---|---|---|
| Component: | contrib.admin | Version: | |
| Severity: | normal | Keywords: | edit-inline ImageField |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
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.
Attachments (1)
Change History (2)
by , 20 years ago
| Attachment: | file_upload_patch added |
|---|
comment:1 by , 20 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
patch to meta/init.py to fix problem