diff options
Diffstat (limited to 'ishtar_common/models_imports.py')
-rw-r--r-- | ishtar_common/models_imports.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py index 5a3af1a05..7462f55be 100644 --- a/ishtar_common/models_imports.py +++ b/ishtar_common/models_imports.py @@ -939,7 +939,7 @@ class Import(models.Model): importer_type = models.ForeignKey(ImporterType) imported_file = models.FileField( _("Imported file"), upload_to="upload/imports/%Y/%m/", max_length=220, - help_text=max_size_help()) + help_text=max_size_help(), blank=True, null=True) imported_images = models.FileField( _("Associated images (zip file)"), upload_to="upload/imports/%Y/%m/", blank=True, null=True, max_length=220, help_text=max_size_help()) @@ -1438,7 +1438,10 @@ class Import(models.Model): for attr in file_attr: file_field = getattr(self, attr) if file_field: - os.remove(file_field.path) + try: + os.remove(file_field.path) + except FileNotFoundError: + pass setattr(self, attr, None) self.save() self._archive_pending = False |