Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#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)

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

Download all attachments as: .zip

Change History (2)

by nichyoung, 19 years ago

Attachment: file_upload_patch added

patch to meta/init.py to fix problem

comment:1 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

(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