mirror of
https://github.com/django/django.git
synced 2025-07-19 03:05:32 +00:00
Fixed #20660 -- Do not try to delete an unset FieldFile
Thanks stanislas.guerra at gmail.com for the report and Baptiste Mispelon for the review.
This commit is contained in:
parent
b5f709e6f4
commit
ea3fe78a9d
2 changed files with 13 additions and 0 deletions
|
@ -96,6 +96,8 @@ class FieldFile(File):
|
|||
save.alters_data = True
|
||||
|
||||
def delete(self, save=True):
|
||||
if not self:
|
||||
return
|
||||
# Only close the file if it's already open, which we know by the
|
||||
# presence of self._file
|
||||
if hasattr(self, '_file'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue