Ticket #7439: added_files_to_get_form_method.diff
File added_files_to_get_form_method.diff, 2.2 KB (added by , 16 years ago) |
---|
-
django/contrib/formtools/wizard.py
30 30 def __repr__(self): 31 31 return "step: %d\nform_list: %s\ninitial_data: %s" % (self.step, self.form_list, self.initial) 32 32 33 def get_form(self, step, data=None ):33 def get_form(self, step, data=None, files=None): 34 34 "Helper method that returns the Form instance for the given step." 35 return self.form_list[step](data, prefix=self.prefix_for_step(step), initial=self.initial.get(step, None))35 return self.form_list[step](data, files, prefix=self.prefix_for_step(step), initial=self.initial.get(step, None)) 36 36 37 37 def num_steps(self): 38 38 "Helper method that returns the number of steps." … … 58 58 # For each previous step, verify the hash and process. 59 59 # TODO: Move "hash_%d" to a method to make it configurable. 60 60 for i in range(current_step): 61 form = self.get_form(i, request.POST )61 form = self.get_form(i, request.POST, request.FILES) 62 62 if request.POST.get("hash_%d" % i, '') != self.security_hash(request, form): 63 63 return self.render_hash_failure(request, i) 64 64 self.process_step(request, form, i) … … 66 66 # Process the current step. If it's valid, go to the next step or call 67 67 # done(), depending on whether any steps remain. 68 68 if request.method == 'POST': 69 form = self.get_form(current_step, request.POST )69 form = self.get_form(current_step, request.POST, request.FILES) 70 70 else: 71 71 form = self.get_form(current_step) 72 72 if form.is_valid(): … … 77 77 # time, as a sanity check, and call done(). 78 78 num = self.num_steps() 79 79 if next_step == num: 80 final_form_list = [self.get_form(i, request.POST ) for i in range(num)]80 final_form_list = [self.get_form(i, request.POST, request.FILES) for i in range(num)] 81 81 82 82 # Validate all the forms. If any of them fail validation, that 83 83 # must mean the validator relied on some other input, such as