Ticket #7667: save_file.diff
File save_file.diff, 1.1 KB (added by , 16 years ago) |
---|
-
django/db/models/fields/__init__.py
832 832 def save_file(self, new_data, new_object, original_object, change, rel, save=True): 833 833 upload_field_name = self.get_manipulator_field_names('')[0] 834 834 if new_data.get(upload_field_name, False): 835 func = getattr(new_object, 'save_%s_file' % self.name)836 835 if rel: 837 836 file = new_data[upload_field_name][0] 838 837 else: 839 838 file = new_data[upload_field_name] 840 839 840 if not file: 841 return 842 841 843 # Backwards-compatible support for files-as-dictionaries. 842 844 # We don't need to raise a warning because Model._save_FIELD_file will 843 845 # do so for us. … … 846 848 except AttributeError: 847 849 file_name = file['filename'] 848 850 851 func = getattr(new_object, 'save_%s_file' % self.name) 849 852 func(file_name, file, save) 850 853 851 854 def get_directory_name(self):