Scenario:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/20116>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Is this the same problem as #19189?
--
Ticket URL: <https://code.djangoproject.com/ticket/20116#comment:1>
Comment (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.
--
Ticket URL: <https://code.djangoproject.com/ticket/20116#comment:2>
* status: new => assigned
* owner: nobody => foonicorn
* has_patch: 0 => 1
Comment:
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.
https://github.com/foonicorn/django/commit/e95124e11ddfcfec356ade1026f6ddfa58bbbd89
--
Ticket URL: <https://code.djangoproject.com/ticket/20116#comment:3>
Comment (by foonicorn):
Updated patch with tests for correct step after each POST request in
`FormsetWizardTests`
https://github.com/foonicorn/django/commit/d906b549065d231a8849ce0c94c7458e18bde08f
--
Ticket URL: <https://code.djangoproject.com/ticket/20116#comment:4>
* stage: Unreviewed => Accepted
Comment:
Hi. For me, this ticket is accepted as an end user should not encounter a
validation error in this case.
--
Ticket URL: <https://code.djangoproject.com/ticket/20116#comment:5>
* needs_docs: 0 => 1
Comment:
Requiring a GET before each POST seems to be backwards incompatible, at
least for tests, so that would need to be documented.
--
Ticket URL: <https://code.djangoproject.com/ticket/20116#comment:6>
* status: assigned => closed
* resolution: => fixed
Comment:
formtools has been extracted into its own repository
(https://github.com/django/django-formtools/). 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: https://github.com/django/django-
formtools/issues/20. Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/20116#comment:7>