diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-05-24 16:26:05 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 08:49:06 +0200 |
commit | 10882ea43688d44ad5a5b5591e28d4936d09cd47 (patch) | |
tree | 1520da68bd4cfa2c4df7675ec822fc52388a0235 /ishtar_common/wizards.py | |
parent | c34b5eb03df8d4287797704ef48b31192f73d949 (diff) | |
download | Ishtar-10882ea43688d44ad5a5b5591e28d4936d09cd47.tar.bz2 Ishtar-10882ea43688d44ad5a5b5591e28d4936d09cd47.zip |
Wizards - JSON fields: tests (refs #4089)
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r-- | ishtar_common/wizards.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 40044f100..a6d0befd5 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -600,7 +600,7 @@ class Wizard(NamedUrlWizardView): dct = self.get_extra_model(dct, form_list) obj = self.get_current_saved_object() data = {} - if obj: + if obj and hasattr(obj, 'data'): data = obj.data # manage dependant items and json fields @@ -647,7 +647,8 @@ class Wizard(NamedUrlWizardView): elif type(dct[k]) not in (list, tuple): dct[k] = [dct[k]] setattr(obj, k, dct[k]) - obj.data = data + if hasattr(obj, 'data'): + obj.data = data if hasattr(obj, 'pre_save'): obj.pre_save() try: @@ -732,7 +733,8 @@ class Wizard(NamedUrlWizardView): except ValidationError as e: logger.warning(unicode(e)) return self.render(form_list[-1]) - obj.data = data + if hasattr(obj, 'data'): + obj.data = data obj.save(**saved_args) for k in adds: getattr(obj, k).add(adds[k]) @@ -1267,7 +1269,7 @@ class Wizard(NamedUrlWizardView): initial = MultiValueDict() # manage json field - if hasattr(self, 'json_fields') \ + if hasattr(obj, 'data') and obj.data and hasattr(self, 'json_fields') \ and getattr(c_form, 'form_slug', None) \ and c_form.form_slug in self.json_fields \ and obj.data: |