Changes between Version 2 and Version 3 of Ticket #32845
- Timestamp:
- Jun 13, 2021, 12:41:17 PM (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #32845 – Description
v2 v3 68 68 }}} 69 69 70 I watched the file name (in my file browser) as the script ran. The file name is successfully changed (as demonstrated by the successful assertions above), but it is then reverted to the original file name when the model instance is saved. This would seem to indicate that contrary to the docs, in order to rename a file that is associated with a model instance (as an ImageField or FileField), it is not sufficient to update model_instance.file.name and then use the os module to rename the file.70 I watched the file name (in my file browser) as the script ran. The file name is successfully changed (as demonstrated by the successful assertions above), but it is then reverted to the original file name when the model instance is saved.