Opened 5 years ago

Closed 4 years ago

#20116 closed Bug (fixed)

ValidationError in form wizard with formsets

Reported by: foonicorn Owned by: foonicorn
Component: contrib.formtools Version: 1.5
Severity: Normal Keywords: formset, wizard
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I encountered an issue with the form wizard when the first step is a formset and the user resends a later step after completing the wizard.

Complete the wizard successfully
Hit the browser back button (page usually comes from cache then)
Send the last form again

Because the wizard's storage gets reseted after completion, the wizard will start with the first step. If the first step is a formset, its ManagementForm raises a ValidationError because the data is passed but doesn't contain the expected values.

Attachments (1)

formwizard_formset_test.diff (2.7 KB) - added by foonicorn 5 years ago.

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by foonicorn

comment:1 Changed 5 years ago by Aymeric Augustin

Is this the same problem as #19189?

comment:2 Changed 5 years ago by steph

No, I think this is another problem, because #19189 is about re-validating things an sending a user back to a form. This ticket is about an finished wizard (done was called and response was rendered) and the user clicks the back button of the browser.

comment:3 Changed 5 years ago by foonicorn

Has patch: set
Owner: changed from nobody to foonicorn
Status: newassigned

I've created a patch that renders the unbound first step if a POST request is sent to a not initialized wizard (storage has no current step). This is the wizard's behavior with normal forms.

Because of this I had to update some tests which did POST requests without preceding GET.

The named wizard is not affected by the issue because the step is addressed in the URL and the data is always directed to the correct form. However in one case step_url had to be assigned to storage.current_step to make the behavior consistent.

comment:4 Changed 5 years ago by foonicorn

Updated patch with tests for correct step after each POST request in FormsetWizardTests

comment:5 Changed 5 years ago by wim@…

Triage Stage: UnreviewedAccepted

Hi. For me, this ticket is accepted as an end user should not encounter a validation error in this case.

comment:6 Changed 4 years ago by Tim Graham

Needs documentation: set

Requiring a GET before each POST seems to be backwards incompatible, at least for tests, so that would need to be documented.

comment:7 Changed 4 years ago by Greg Chapple

Resolution: fixed
Status: assignedclosed

formtools has been extracted into its own repository (​​ Because of this, the issue tracking for this package has been moved to GitHub issues. I'm going to close this ticket, but I've created a GitHub issue to replace it where the conversation can continue: ​​ Thanks!

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