Opened 2 years ago

Closed 2 years ago

#19245 closed Bug (needsinfo)

Form Wizard does not support all steps being conditionally skipped at the same time

Reported by: gp Owned by: nobody
Component: Forms Version: 1.4
Severity: Normal 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

I am using a form wizard that works with models in the database. After the form wizard is run initially, all steps in the form wizard are conditionally skipped until a change is made that requires the form wizard to run again. I do not want to ask the user to verify the record more than once.

I would expect the form wizard index view to redirect to the form wizards done/finished view. However, the form wizard index redirects to the first step even though it is skipped and I get an exception.

This seems to be caused by the assumption that the form wizard will always have at least one step that is not skipped.

I think it would make sense for the index to directly skip to the done_step_name if there are no steps.

traceback:

Django Version: 1.4.1
Python Version: 2.7.3

Traceback:
File "C:\path\to\django\core\handlers\base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "C:\path\to\django\views\generic\base.py" in view
  48.             return self.dispatch(request, *args, **kwargs)
File "C:\path\to\django\contrib\formtools\wizard\views.py" in dispatch
  223.         response = super(WizardView, self).dispatch(request, *args, **kwargs)
File "C:\path\to\django\views\generic\base.py" in dispatch
  69.         return handler(request, *args, **kwargs)
File "C:\path\to\django\contrib\formtools\wizard\views.py" in post
  653.         return super(NamedUrlWizardView, self).post(*args, **kwargs)
File "C:\path\to\django\contrib\formtools\wizard\views.py" in post
  289.                 return self.render_next_step(form)
File "C:\path\to\django\contrib\formtools\wizard\views.py" in render_next_step
  669.         next_step = self.get_next_step()
File "C:\path\to\django\contrib\formtools\wizard\views.py" in get_next_step
  479.         key = form_list.keyOrder.index(step) + 1

Exception Type: ValueError at /long/path/step-name/
Exception Value: u'step-name' is not in list

Change History (2)

comment:1 Changed 2 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Type changed from Uncategorized to Bug

comment:2 Changed 2 years ago by russellm

  • Resolution set to needsinfo
  • Status changed from new to closed

Thanks for the report, but it's a bit difficult to work out what you're describing without a full example -- the stack trace is nice, but doesn't really help unless we can see the code that caused it to break.

Can you provide a minimal example that reproduces the problem you've found? If you can, please reopen this ticket.

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