Code

Ticket #7683: 7683.diff

File 7683.diff, 687 bytes (added by gorman, 6 years ago)

Patch for #7683

Line 
1Index: django/db/models/base.py
2===================================================================
3--- django/db/models/base.py    (revision 7922)
4+++ django/db/models/base.py    (working copy)
5@@ -528,8 +528,8 @@
6         full_filename = self._get_FIELD_filename(field)
7         if hasattr(raw_field, 'temporary_file_path'):
8             # This file has a file path that we can move.
9+            file_move_safe(raw_field.temporary_file_path(), full_filename)
10             raw_field.close()
11-            file_move_safe(raw_field.temporary_file_path(), full_filename)
12         else:
13             # This is a normal uploadedfile that we can stream.
14             fp = open(full_filename, 'wb')