From c3b928b50cda4c087699fff50fd6e91dd75d2580 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 24 Jul 2017 19:34:27 +0200 Subject: Datings: post-fix of duplicates associated to the same object (usually on imports) --- ishtar_common/data_importer.py | 3 +++ ishtar_common/wizards.py | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'ishtar_common') diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index e11e72449..dbc7c21cb 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -1538,6 +1538,9 @@ class Importer(object): if m2ms: # force post save script obj.save() + if hasattr(obj, 'fix'): + # post save/m2m specific fix + obj.fix() except IntegrityError as e: message = e.message try: diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 3f90f8c48..c5158dfcd 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -757,6 +757,10 @@ class Wizard(NamedUrlWizardView): item.skip_history_when_saving = True item.save() + if hasattr(obj, 'fix'): + # post save/m2m specific fix + obj.fix() + # make the new object a default if self.current_obj_slug: self.request.session[self.current_obj_slug] = unicode(obj.pk) -- cgit v1.2.3