I have a form wizard containing 3 forms. Basically, I am trying to transfer data from the first and second forms to the third. I tried to add a dictionary attribute to the wizard class and update this dictionary every time the process_step method is called. The Django 1.4 documentation says that this method is called every time a page is displayed for all the steps presented.
In the following code example, the dictionary attribute is changed using the integer self.test to keep it simple. In this case, every time the process_step method is called, the value of self.test is 2, never increases. The __init__ method seems to be invoked for each form.
class MyWizard(SessionWizardView): def __init__(self, *args, **kwargs): super(MyWizard, self).__init__(*args, **kwargs) self.test = 1 def process_step(self, form): self.test += 1 print self.test return self.get_form_step_data(form)
Besides this solution, is there a more elegant way to transfer data between forms of a form wizard?
source share