#19285: Allow to redirect user back in Form wizard -----------------------------------+------------------------------------ Reporter: azurit | Owner: nobody Type: New feature | Status: new Component: contrib.formtools | Version: 1.4 Severity: Normal | Keywords: form wizard formwizard Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 -----------------------------------+------------------------------------ I was fighting with problem in allowing to redirect user back when using Form wizard. Here is the use case:
- user1 will choose a login and password in first step, login availability is checked - user1 is redirected to second step where he needs to fill up other important data for creating his account - meanwhile, user2 registers and takes login of user1 - finally, we got an error when creating the account for user1. here we need to redirect him to first step and ask him for another login I wasn't able to find any way how to do this. Finally i was trying to simulate usage of 'Go back' button, which is defined in contrib/formtools/wizard/views.py in WizardView.post() method: {{{#!python # Look for a wizard_goto_step element in the posted data which # contains a valid step name. If one was found, render the requested # form. (This makes stepping back a lot easier). wizard_goto_step = self.request.POST.get('wizard_goto_step', None) if wizard_goto_step and wizard_goto_step in self.get_form_list(): self.storage.current_step = wizard_goto_step form = self.get_form( data=self.storage.get_step_data(self.steps.current), files=self.storage.get_step_files(self.steps.current)) return self.render(form) }}} Unfortunately this won't work in final step, becase of resetting the form wizard in the same file at the end of WizardView.render_done() method: {{{#!python done_response = self.done(final_form_list, * *kwargs) self.storage.reset() return done_response }}} I altered this method to make it work also in final step like this: {{{#!python done_response = self.done(final_form_list, **kwargs) if self.steps.current == self.steps.last: self.storage.reset() return done_response }}} Do you consider this as a usefull patch which can be included in Django? Or can you suggest another correct way how to do this? -- Ticket URL: <https://code.djangoproject.com/ticket/19285> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.