Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#312 closed defect (fixed)

Adding images fails for edit-inline with width_field set

Reported by: nichyoung Owned by: adrian
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: UI/UX:


Adding an record containing an image using edit-inline fails with the error:

"$DJANGO_SRC/django/core/meta/", 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/ 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)

file_upload_patch (732 bytes) - added by nichyoung 10 years ago.
patch to meta/ to fix problem

Download all attachments as: .zip

Change History (2)

Changed 10 years ago by nichyoung

patch to meta/ to fix problem

comment:1 Changed 10 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(In [1104]) Fixed #312 -- Fixed bug when adding images in the admin when edit_inline and width field is set. Thanks, nichyoung

Note: See TracTickets for help on using tickets.
Back to Top