Closed CruzR closed 3 years ago
Frankly, I think that the use case is too specific to integrate something like that in WizardView. So your suggestion to subclass WizardView looks right to me. If by doing this, you see possible improvements, you may open new tickets with such proposals.
Alright, I'll do that then. Thanks for the quick reply!
If it helps, I had to do exactly this.
The only thing I really needed to change was to make get_form()
use get_form_list()
instead of how it currently references things.
I'd like to dynamically insert wizard steps based on form data from an earlier step. To be more specific, I have a
ModelMultipleChoiceField
in one step, and I'd like to insert a step for each selected model. As I understand it, the only way to have some kind of dynamic step selection right now is thecondition_dict
mechanism, which won't work because it can only skip steps known to exist in advance.FormSet
s orModelFormSet
s also don't work for my use case because the form inserted should not be a form for the chosen model instance, but rather a form determined by an attribute of the chosen model instance.I think for now I can probably work around this, either by defining a maximum number of steps and skipping each that does not have a corresponding model in the choice field, or by subclassing WizardView in order to allow dynamic step insertion.
But if this is something that might be interesting to have in django-formtools proper, maybe we can discuss how to implement this and I can prepare a PR.