summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-22 13:35:45 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:24 +0100
commit5c9701f05ddaba63d957f1973652be545a57bea0 (patch)
tree5681d0db3a55428e21f42696827942aa6aca8d34
parenta3917c23b6838c8f601f6286263493229ddc3208 (diff)
downloadIshtar-5c9701f05ddaba63d957f1973652be545a57bea0.tar.bz2
Ishtar-5c9701f05ddaba63d957f1973652be545a57bea0.zip
Imports: imported file not mandatory (when zipped can be null) - do not raise error if media file is missing
-rw-r--r--archaeological_finds/tests/notices-panier.odtbin0 -> 55063 bytes
-rw-r--r--ishtar_common/migrations/0212_auto_20210222_1334.py (renamed from ishtar_common/migrations/0212_auto_20210219_1408.py)7
-rw-r--r--ishtar_common/models_imports.py7
3 files changed, 11 insertions, 3 deletions
diff --git a/archaeological_finds/tests/notices-panier.odt b/archaeological_finds/tests/notices-panier.odt
new file mode 100644
index 000000000..71b248e79
--- /dev/null
+++ b/archaeological_finds/tests/notices-panier.odt
Binary files differ
diff --git a/ishtar_common/migrations/0212_auto_20210219_1408.py b/ishtar_common/migrations/0212_auto_20210222_1334.py
index 25d49e75f..703b58f2b 100644
--- a/ishtar_common/migrations/0212_auto_20210219_1408.py
+++ b/ishtar_common/migrations/0212_auto_20210222_1334.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Generated by Django 1.11.27 on 2021-02-19 14:08
+# Generated by Django 1.11.27 on 2021-02-22 13:34
from __future__ import unicode_literals
from django.db import migrations, models
@@ -29,6 +29,11 @@ class Migration(migrations.Migration):
field=models.CharField(blank=True, choices=[('M', 'Male'), ('F', 'Female'), ('N', 'Neutral')], default='', help_text=ishtar_common.models.documentation_get_gender_values, max_length=1, verbose_name='Grammatical gender'),
),
migrations.AlterField(
+ model_name='import',
+ name='imported_file',
+ field=models.FileField(blank=True, help_text='La taille maximale supportée pour le fichier est de 100 Mo.', max_length=220, null=True, upload_to='upload/imports/%Y/%m/', verbose_name='Imported file'),
+ ),
+ migrations.AlterField(
model_name='organization',
name='grammatical_gender',
field=models.CharField(blank=True, choices=[('M', 'Male'), ('F', 'Female'), ('N', 'Neutral')], default='', help_text=ishtar_common.models.documentation_get_gender_values, max_length=1, verbose_name='Grammatical gender'),
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