Code

Opened 6 years ago

Closed 6 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: Tyson Wenger <twenger2@…> Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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:

  1. 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

  1. 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.

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #6893

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.