Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormWizard doesn't work with FormSet/formset_factory() #212

Open
murraylchapman opened this issue May 3, 2022 · 0 comments
Open

FormWizard doesn't work with FormSet/formset_factory() #212

murraylchapman opened this issue May 3, 2022 · 0 comments

Comments

@murraylchapman
Copy link

If you have a FormWizard step that generates a form(set) via FormSet.form_factory() then you end up with a mess where FormWizard drops a formtools.wizard.views.ManagementForm into the page but it's validated inside Django as if it's a django.forms.formset.ManagementForm.

This manifests as either a "management form has been messed with" error or an KeyError when FormSet.full_clean() does self.management_form.cleaned_data[TOTAL_FORM_COUNT].

I figured out that you can get around this by handing formset_factory a custom FormSet that overrides the non_form_errors() method, but it's a crude fix I'm not sure will be very portable.

IMHO FormWizard should provide a proper FormSet base class for use in formset_factory that creates management forms that will survive validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant