diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-11-30 13:20:53 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-11-30 13:20:53 +0100 |
commit | 227885e4a6b2df9e4df1507d93c31dd30c5b458a (patch) | |
tree | 7e216f7c036ae568407d46359dea361f2a641098 /ishtar_common/wizards.py | |
parent | d7d137c4b1689545abe9dc9af3ab936d0200a05f (diff) | |
download | Ishtar-227885e4a6b2df9e4df1507d93c31dd30c5b458a.tar.bz2 Ishtar-227885e4a6b2df9e4df1507d93c31dd30c5b458a.zip |
Simple treatment form. Treatment listing. (refs #3365)
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r-- | ishtar_common/wizards.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index c065459f6..b9fba83b4 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -126,6 +126,8 @@ class Wizard(NamedUrlWizardView): current_obj_slug = '' file_storage = default_storage + saved_args = {} # argument to pass on object save + ''' # buggy and unecessary... def __init__(self, *args, **kwargs): @@ -543,12 +545,16 @@ class Wizard(NamedUrlWizardView): dct[dependant_item] = c_item if 'pk' in dct: dct.pop('pk') + saved_args = self.saved_args.copy() + for k in saved_args: + if k in dct: + saved_args[k] = dct.pop(k) obj = self.get_saved_model()(**dct) try: obj.full_clean() except ValidationError: return self.render(form_list[-1]) - obj.save() + obj.save(**saved_args) for k in adds: getattr(obj, k).add(adds[k]) # necessary to manage interaction between models like @@ -626,6 +632,7 @@ class Wizard(NamedUrlWizardView): self.request.session[self.current_obj_slug] = unicode(obj.pk) self.request.session[self.get_object_name(obj)] = unicode(obj.pk) dct = {'item': obj} + self.current_object = obj # force evaluation of lazy urls wizard_done_window = unicode(self.wizard_done_window) if wizard_done_window: |