summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBojan Mihelac <bmihelac@mihelac.org>2015-01-12 07:44:52 (GMT)
committerBojan Mihelac <bmihelac@mihelac.org>2015-01-12 07:44:52 (GMT)
commit427588e9936a176090ecf2f9aa43aecac9f1425a (patch)
treeadd2df6ab9c1155a164e6b2d8145bd99ae624554
parentfc9c5eedbce313fee8628d4fd1b3d22d8f7f958c (diff)
parent61bdedc3fee3750571838829c7b47e1bd8459327 (diff)
downloaddjango-import-export-427588e9936a176090ecf2f9aa43aecac9f1425a.zip
django-import-export-427588e9936a176090ecf2f9aa43aecac9f1425a.tar.gz
django-import-export-427588e9936a176090ecf2f9aa43aecac9f1425a.tar.bz2
Merge pull request #194 from rhunwicks/master
Call before_import before creating the instance_loader - fixes #193
-rw-r--r--import_export/resources.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/import_export/resources.py b/import_export/resources.py
index 717240b..3663ee4 100644
--- a/import_export/resources.py
+++ b/import_export/resources.py
@@ -304,8 +304,6 @@ class Resource(six.with_metaclass(DeclarativeMetaclass)):
else:
real_dry_run = dry_run
- instance_loader = self._meta.instance_loader_class(self, dataset)
-
try:
self.before_import(dataset, real_dry_run)
except Exception as e:
@@ -317,6 +315,8 @@ class Resource(six.with_metaclass(DeclarativeMetaclass)):
transaction.leave_transaction_management()
raise
+ instance_loader = self._meta.instance_loader_class(self, dataset)
+
for row in dataset.dict:
try:
row_result = RowResult()