diff options
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/data_importer.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index 61c294b28..ff803f3f8 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -2079,6 +2079,7 @@ class Importer(object): created = False post_save_keys = [] get_by_unicity_key = False + obj = None try: try: dct = {} @@ -2122,7 +2123,6 @@ class Importer(object): new_dct.update(dct) dct = new_dct - obj = None if self.simulate: q = cls.objects.filter(**dct) if not q.count(): @@ -2216,6 +2216,7 @@ class Importer(object): if ( not self.simulate and self.import_instance + and obj and hasattr(obj, "imports") and created ): @@ -2318,7 +2319,8 @@ class Importer(object): message ) ) - self._add_to_post_save(obj.__class__, obj.pk, idx_line) + if obj: + self._add_to_post_save(obj.__class__, obj.pk, idx_line) return obj, created def _format_csv_line(self, values, empty="-"): |