From 762506d43e8bc38736d52c687d20515d48a75d49 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 9 Dec 2015 15:38:07 +0100 Subject: Add related fields save management in wizard --- ishtar_common/wizards.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'ishtar_common') diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 45b46eb63..908a84a46 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -432,7 +432,21 @@ class Wizard(NamedUrlWizardView): obj.save() else: adds = {} + # manage attributes relations + if hasattr(self.model, 'ATTRS_EQUIV'): + for k in other_objs: + if k in self.model.ATTRS_EQUIV: + new_k = self.model.ATTRS_EQUIV[k] + if new_k in other_objs: + other_objs[new_k].update( + other_objs[k]) + else: + other_objs[new_k] = \ + other_objs[k].copy() for dependant_item in other_objs: + if hasattr(self.model, 'ATTRS_EQUIV') and \ + dependant_item in self.model.ATTRS_EQUIV: + continue m = getattr(self.model, dependant_item) if callable(m): m = m() -- cgit v1.2.3