Skip to content

Commit 1ecabe2

Browse files
Mahmudul HasanMahmudul Hasan
authored andcommitted
Default import mode configuration added
1 parent 5347419 commit 1ecabe2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ A fully configured example project can be found in the example directory of this
4949
The available parameters are `app_label`, `model_name`, and `resource`. 'resource' should be a function which returns a django-import-export `Resource <https://django-import-export.readthedocs.io/en/latest/api_resources.html>`__.
5050

5151
3. Done
52+
4. Configure to turn off default dry run import. By default dry run import is `True`
53+
54+
::
55+
56+
IMPORT_DRY_RUN_FIRST_TIME = False
5257

5358

5459
Preforming an import

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)