summaryrefslogtreecommitdiff
path: root/ishtar_common/data_importer.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-11-18 15:21:09 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:23:19 +0100
commit692dc14945b618df73a3a08272fda6a57ca718e1 (patch)
treef4717aadec82a70c8e21ef23b889fb07a6f082d5 /ishtar_common/data_importer.py
parent8e5db18d4fbe70be0aa602da4a3d0befb587fead (diff)
downloadIshtar-692dc14945b618df73a3a08272fda6a57ca718e1.tar.bz2
Ishtar-692dc14945b618df73a3a08272fda6a57ca718e1.zip
Fix step by step import advance
Diffstat (limited to 'ishtar_common/data_importer.py')
-rw-r--r--ishtar_common/data_importer.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py
index d58c9019e..63a8d65cf 100644
--- a/ishtar_common/data_importer.py
+++ b/ishtar_common/data_importer.py
@@ -1057,12 +1057,12 @@ class Importer(object):
def post_import(self):
related_list = {}
- if self.import_instance:
+ if self.import_instance and not self.line_to_process:
self.import_instance.state = "PP"
self.import_instance.imported_line_numbers = ""
self.import_instance.save()
for cls_pk, idx_line in self.post_save_items.items():
- if self.import_instance:
+ if self.import_instance and not self.line_to_process:
self.import_instance.add_imported_line(idx_line)
cls, pk = cls_pk
# force django based post-processing for the item
@@ -1147,7 +1147,8 @@ class Importer(object):
table, self.output, choose_default=choose_default, user=user
)
self.simulate = simulate
- return self._importation(table, line_to_process=line_to_process)
+ self.line_to_process = line_to_process
+ return self._importation(table)
def get_current_values(self, obj):
return obj
@@ -1235,7 +1236,7 @@ class Importer(object):
current_data = current_data[key]
return data
- def _importation(self, table, line_to_process=None):
+ def _importation(self, table):
self.match_table = {}
table = list(table)
if not table or not table[0]:
@@ -1274,10 +1275,10 @@ class Importer(object):
results = []
for idx_line, line in enumerate(table):
self.idx_line = idx_line
- if line_to_process is not None:
- if line_to_process != idx_line:
+ if self.line_to_process is not None:
+ if self.line_to_process != idx_line:
continue
- if idx_line > line_to_process:
+ if idx_line > self.line_to_process:
return results
if self.output == "cli":
left = None