Opened 16 years ago
Closed 16 years ago
#7363 closed (duplicate)
Form wizard has a bug in get_template(self, step). The 'step' variable is always 0, it never gets incremented.
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Uncategorized | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When I override this function below, the "step" variable always stays set to 0. It never gets
updated. Therefore only my template_0.html gets loaded. I want it to
continue down the line like template_0.html, template_1.html, ...and so on.
def get_template(self, step):
return 'vlis/production/order/template_%s.html' % step
Unless I am really mistaken and doing something wrong, I am pretty sure this is a bug. The
"self.step" variable in "wizard.py" is never being updated after the
forms are submitted from one page to the next.
These are two possible fixes I found that might work:
- In the method "def call(self, request, *args, kwargs) :"
update the self.step variable after the is_valid() function is checked.
Coding
Revision:
if form.is_valid():
......
if next_step == num:
.....
else:
form = self.get_form(next_step)
current_step = next_step
self.step = current_step #new code here
- In the method "def render_template(self, request, form, previous_fields, step, context=None):"
replace "self.step" with the functions "step" argument value instead.
Coding*
Previous:
context.update(self.extra_context)
return render_to_response(self.get_template(self.step),
dict(context,...
Revision:
context.update(self.extra_context)
return render_to_response(self.get_template(step),
dict(context,...
If anyone can verify that they have the same problem, I will submit
this to a bug fix. Thanks.
Duplicate of #6893