Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#8385 closed (duplicate)

Issue with step parameter's value when overriding get_template method of FormWizard class.

Reported by: wpatyna Owned by: nobody
Component: contrib.formtools Version: dev
Severity: Keywords:
Cc: Triage Stage: Fixed on a branch
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I found some issue when I was trying to use FormWizard's child class with overriden get_template method.
The problem was with the value of step parameter used to determine custome template for particular step. This parameter is always 0, no matter which current step is. When I browse the source of the FormWizard class I found that self.step is never update and the issue comes from calling:

 return render_to_response(self.get_template(self.step), dict(context,
            step_field=self.step_field_name,
            step0=step,
            step=step + 1,
            step_count=self.num_steps(),
            form=form,
            previous_fields=previous_fields
        ), context_instance=RequestContext(request))

Quick fix is to change above code to:

        return render_to_response(self.get_template(step), dict(context,
            step_field=self.step_field_name,
            step0=step,
            step=step + 1,
            step_count=self.num_steps(),
            form=form,
            previous_fields=previous_fields
        ), context_instance=RequestContext(request))

(Changed self.step to step when calling get_template method)

I hope I haven't misunderstand some trick ;)

Change History (2)

comment:1 by wpatyna, 16 years ago

Resolution: duplicate
Status: newclosed
Triage Stage: UnreviewedFixed on a branch

This seems to be a duplicate for ticket #6893

comment:2 by Jacob, 13 years ago

milestone: 1.0

Milestone 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top