diff options
-rw-r--r-- | ishtar_common/wizards.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 21cfa6ceb..180ed4618 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -408,6 +408,8 @@ class Wizard(NamedUrlWizardView): return self.render(form_list[-1]) for dependant_item in other_objs: c_item = getattr(obj, dependant_item) + if callable(c_item): + c_item = c_item() # manage ManyToMany if only one associated if hasattr(c_item, "all"): c_items = c_item.all() @@ -781,10 +783,12 @@ class Wizard(NamedUrlWizardView): if base_model: key = base_model + 's' initial.setlist(base_field, [ - unicode(val.pk) for val in getattr(obj, key).all()]) + unicode(val.pk) for val in getattr(value, key).all()]) else: fields = base_field.split('__') for field in fields: + if callable(value): + value = value() if not hasattr(value, field) or \ getattr(value, field) is None: value = obj |