Skip to content

Commit afe519b

Browse files
authored
Merge pull request #90 from xalien10/default_settings_for_import
Default import mode configuration added
2 parents 4e3e973 + 1f02c4a commit afe519b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ A fully configured example project can be found in the example directory of this
5151
3. Done
5252

5353

54+
By default a dry run of the import is initiated when the import object is created. To instead import the file immediately without a dry-run set the `IMPORT_DRY_RUN_FIRST_TIME` to `False`
55+
56+
::
57+
58+
IMPORT_DRY_RUN_FIRST_TIME = False
59+
60+
5461
Preforming an import
5562
--------------------
5663

import_export_celery/models/importjob.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Copyright (C) 2019 o.s. Auto*Mat
22

3+
from django.conf import settings
34
from django.utils import timezone
45

56
from author.decorators import with_author
@@ -82,4 +83,4 @@ def importjob_post_save(sender, instance, **kwargs):
8283
if not instance.processing_initiated:
8384
instance.processing_initiated = timezone.now()
8485
instance.save()
85-
transaction.on_commit(lambda: run_import_job.delay(instance.pk, dry_run=True))
86+
transaction.on_commit(lambda: run_import_job.delay(instance.pk, dry_run=getattr(settings, "IMPORT_DRY_RUN_FIRST_TIME", True)))

0 commit comments

Comments
 (0)