Code

Ticket #10810: wizard_revalidation.diff

File wizard_revalidation.diff, 1.4 KB (added by Qrilka, 5 years ago)

patch for FormWizard

Line 
1Index: django/contrib/formtools/wizard.py
2===================================================================
3--- django/contrib/formtools/wizard.py  (revision 9975)
4+++ django/contrib/formtools/wizard.py  (working copy)
5@@ -76,19 +76,19 @@
6             self.process_step(request, form, current_step)
7             next_step = current_step + 1
8 
9-            # If this was the last step, validate all of the forms one more
10+            # If this was the last step, validate all of the previous forms one more
11             # time, as a sanity check, and call done().
12             num = self.num_steps()
13             if next_step == num:
14-                final_form_list = [self.get_form(i, request.POST) for i in range(num)]
15+                prior_form_list = [self.get_form(i, request.POST) for i in range(num - 1)]
16 
17                 # Validate all the forms. If any of them fail validation, that
18                 # must mean the validator relied on some other input, such as
19                 # an external Web site.
20-                for i, f in enumerate(final_form_list):
21+                for i, f in enumerate(prior_form_list):
22                     if not f.is_valid():
23                         return self.render_revalidation_failure(request, i, f)
24-                return self.done(request, final_form_list)
25+                return self.done(request, prior_form_list+[form])
26 
27             # Otherwise, move along to the next step.
28             else: