From a52c06fe5a74d1b8c1f5c940932ce96e5fdc622d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 27 Nov 2015 17:25:29 +0100 Subject: Wizard: fix callable attributes --- ishtar_common/wizards.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ishtar_common') diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 5f3d440e4..8fe1b5da2 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -423,6 +423,8 @@ class Wizard(NamedUrlWizardView): c_item.save() else: m = getattr(self.model, dependant_item) + if callable(m): + m = m() if hasattr(m, 'related'): c_item = m.related.model(**other_objs[dependant_item]) setattr(obj, dependant_item, c_item) @@ -432,6 +434,8 @@ class Wizard(NamedUrlWizardView): adds = {} for dependant_item in other_objs: m = getattr(self.model, dependant_item) + if callable(m): + m = m() model = m.field.rel.to c_dct = other_objs[dependant_item].copy() if issubclass(model, models.BaseHistorizedItem): -- cgit v1.2.3