Opened 17 years ago
Closed 17 years ago
#7169 closed (duplicate)
Minor bug in wizards.py :: render_template
Reported by: | tzellman | Owned by: | nobody |
---|---|---|---|
Component: | contrib.formtools | Version: | dev |
Severity: | Keywords: | formtools wizard | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This is actually only a problem if (a) you are using (or copied) the default render_template, and (b) you are overriding the get_template method to return different pages based on the passed-in step variable. The error is on line 212. The code is currently using the self.step variable instead of the passed-in step variable. The problem (as you will see) is that the self.step variable is never mutated, other than in the constructor. Therefore, every time render_template is called, self.step will be 0, and the 1st template will be requested.
Current code:
return render_to_response(self.get_template(self.step), dict(context,
Proposed fix:
return render_to_response(self.get_template(step), dict(context,
In addition, you may consider updating the self.step value. Currently it doesn't really serve any purpose.
This wasn't a show stopper for me since I provided my own render_template method in my subclass. I just wanted to make you guys aware.
Thanks,
Tom
I didn't realize someone had just submitted ticket #7168. Same bug request. Just note that self.step is never modified and is therefore useless.