0

I'm using django's built-in Form wizard SessionWizardView to split a form across several pages.

When calling the Form wizard, users are being displayed an Select input field which expects an option A or B to be chosen. This choice affects the next steps to be displayed. This means that I basically have two totally different form lists - which of these gets processed by the Form wizard depends on the choice in the first step, e.g:

Step 1: Choice A -> use form list A
or
Step 1: Choice B -> use form list B

What is an elegant , django-friendly way to achieve this dynamic workflow?

kinkee
  • 368
  • 2
  • 12
  • 1
    See this question http://stackoverflow.com/questions/19068452/django-formwizard-how-to-change-the-form-list-dynamically – Rohan Apr 24 '14 at 07:55
  • Thanks for sharing the link. I've already discovered this question before asking mine. The solution suggested there left me kind of dissatisfied as I'd have to check every single step and return the proper form for it. In my case this would mean to check for roughly 10 steps. – kinkee Apr 24 '14 at 08:02
  • You can return form only for those steps that need such dynamic form selection. – Rohan Apr 24 '14 at 08:30
  • I think I'm missunderstanding ... Basically I need two totally different form lists. Which one to choose depends on the choice in the first step. So overriding `get_form` would mean to check in every step which choice has been made in the first step and then return the proper form. Since the form lists are different, these checking has to be done in every step > step1. – kinkee Apr 24 '14 at 09:51

1 Answers1

2

I would like to keep such selections that would drive the way a wizard would be displayed, outside the wizard. I would define a view for the initial selection (you are making in the first page) and let the view decide the which formlist would be used to display the wizard (depending on the selection made)

rreddy
  • 95
  • 5