Opened 7 years ago

Closed 7 years ago

Last modified 3 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: master
Severity: Keywords:
Cc: Triage Stage: Fixed on a branch
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 Changed 7 years ago by wpatyna

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed
  • Triage Stage changed from Unreviewed to Fixed on a branch

This seems to be a duplicate for ticket #6893

comment:2 Changed 3 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

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