1 | Index: manipulators.py
|
---|
2 | ===================================================================
|
---|
3 | --- manipulators.py (revision 3202)
|
---|
4 | +++ manipulators.py (working copy)
|
---|
5 | @@ -96,15 +96,19 @@
|
---|
6 | if self.change:
|
---|
7 | params[self.opts.pk.attname] = self.obj_key
|
---|
8 |
|
---|
9 | - # First, save the basic object itself.
|
---|
10 | +
|
---|
11 | + # Create object reference
|
---|
12 | new_object = self.model(**params)
|
---|
13 | - new_object.save()
|
---|
14 |
|
---|
15 | - # Now that the object's been saved, save any uploaded files.
|
---|
16 | + # Save uploaded files
|
---|
17 | for f in self.opts.fields:
|
---|
18 | if isinstance(f, FileField):
|
---|
19 | f.save_file(new_data, new_object, self.change and self.original_object or None, self.change, rel=False)
|
---|
20 |
|
---|
21 | +
|
---|
22 | + # Now save the object
|
---|
23 | + new_object.save()
|
---|
24 | +
|
---|
25 | # Calculate which primary fields have changed.
|
---|
26 | if self.change:
|
---|
27 | self.fields_added, self.fields_changed, self.fields_deleted = [], [], []
|
---|