I have created a Django Form Wizard which works fine. However, after finishing the wizard and starting it again, it loads the data generated during its previous use. Instead I would like it to clear the previous wizard state and start over once it was finished successful. I have tried modifying the done method of the wizard, but it doesn’t do the trick:
def done(self, form_list, **kwargs):
self.instance_dict = {}
self.storage.reset()
return HttpResponseRedirect('/foo/')
What do I have to change to make the wizard work the way I need it? My wizard extends the NamedUrlSessionWizardView class.
I am not 100% sure if this is true, but I think the following worked:
I was saving instances of forms in my wizard like this:
but for some reason
didn’t clear that data. Instead I moved to saving the objects in extra data:
Which I then retrieve inside the
def get_form_instance(self, step)method of the wizard, for example like this:That data apparently got cleared successfully with the above mentioned done method. However, in the end I dropped the whole form-wizard thing due to more complications and just went with a one-step form.