Skip to content
Browse files

Fixed #7667: fixied FileField.save_file for inline related objects. T…

…his is really just papering over a bigger problem that should get fixed either by newforms-admin or the file-storage refactoring, but this fix makes the admin work until either of those things happen. Thanks, oggy.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent c121ff4 commit 5f73e2c4fa5f40f528d4d1d6999697e7f3f5248f @jacobian jacobian committed
Showing with 4 additions and 1 deletion.
  1. +4 −1 django/db/models/fields/
5 django/db/models/fields/
@@ -835,12 +835,14 @@ def get_manipulator_field_names(self, name_prefix):
def save_file(self, new_data, new_object, original_object, change, rel, save=True):
upload_field_name = self.get_manipulator_field_names('')[0]
if new_data.get(upload_field_name, False):
- func = getattr(new_object, 'save_%s_file' %
if rel:
file = new_data[upload_field_name][0]
file = new_data[upload_field_name]
+ if not file:
+ return
# Backwards-compatible support for files-as-dictionaries.
# We don't need to raise a warning because Model._save_FIELD_file will
# do so for us.
@@ -849,6 +851,7 @@ def save_file(self, new_data, new_object, original_object, change, rel, save=Tru
except AttributeError:
file_name = file['filename']
+ func = getattr(new_object, 'save_%s_file' %
func(file_name, file, save)
def get_directory_name(self):

0 comments on commit 5f73e2c

Please sign in to comment.
Something went wrong with that request. Please try again.