Ticket #1564: manipulators.diff

File manipulators.diff, 898 bytes (added by oyvind@…, 9 years ago)

Diff to save file before saving in manipulator

  • django/db/models/manipulators.py

     
    9898
    9999        # First, save the basic object itself.
    100100        new_object = self.model(**params)
    101         new_object.save()
    102101
    103         # Now that the object's been saved, save any uploaded files.
     102        # Now that the object's not yet been saved, save any uploaded files.
    104103        for f in self.opts.fields:
    105104            if isinstance(f, FileField):
    106105                f.save_file(new_data, new_object, self.change and self.original_object or None, self.change, rel=False)
    107 
     106               
     107        new_object.save()
     108       
    108109        # Calculate which primary fields have changed.
    109110        if self.change:
    110111            self.fields_added, self.fields_changed, self.fields_deleted = [], [], []
Back to Top