diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-12-09 15:38:07 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-12-09 15:38:07 +0100 |
commit | 89c904b2e12418938c5bd97bee5bab8e41ec1461 (patch) | |
tree | bdecc65686f3215f5c7e1a4ee9110140004ecb33 /ishtar_common | |
parent | 61cf9ee1bd8e9c7996d71207981f940fd469a546 (diff) | |
download | Ishtar-89c904b2e12418938c5bd97bee5bab8e41ec1461.tar.bz2 Ishtar-89c904b2e12418938c5bd97bee5bab8e41ec1461.zip |
Add related fields save management in wizard
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/wizards.py | 14 |
1 files changed, 14 insertions, 0 deletions
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() |