Ticket #8613: r8649-save-file-removal.diff

File r8649-save-file-removal.diff, 1.3 KB (added by Ivan Giuliani, 16 years ago)

Removes FileField.save_file

  • django/db/models/fields/files.py

     
    178178            # Otherwise, just close the file, so it doesn't tie up resources.
    179179            file.close()
    180180
    181     def save_file(self, new_data, new_object, original_object, change, rel,
    182                   save=True):
    183         upload_field_name = self.name + '_file'
    184         if new_data.get(upload_field_name, False):
    185             if rel:
    186                 file = new_data[upload_field_name][0]
    187             else:
    188                 file = new_data[upload_field_name]
    189 
    190             # Backwards-compatible support for files-as-dictionaries.
    191             # We don't need to raise a warning because the storage backend will
    192             # do so for us.
    193             try:
    194                 filename = file.name
    195             except AttributeError:
    196                 filename = file['filename']
    197             filename = self.get_filename(filename)
    198 
    199             getattr(new_object, self.attname).save(filename, file, save)
    200 
    201181    def get_directory_name(self):
    202182        return os.path.normpath(force_unicode(datetime.datetime.now().strftime(smart_str(self.upload_to))))
    203183
Back to Top