I was hoping to be able to override the render_done method and raise a
ValidationError for some fields and have the Wizard show those errors on
the relevant step, but it appears that the Wizard simply performs a
redirect which means you can't actually do any additional validation (this
may be a separate issue though). Either way, I noticed that although the
form object (with errors added) is passed to render_revalidation_failure,
it doesn't actually get used, unlike render_revalidation_failure used in
the base WizardView.
--
Ticket URL: <https://code.djangoproject.com/ticket/22785>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_docs: => 0
* resolution: => needsinfo
* needs_tests: => 0
* needs_better_patch: => 0
Comment:
How should it be used? The `render_revalidation_failure()` method needs to
have the same signature across all subclasses regardless of whether or not
the subclasses uses them all.
--
Ticket URL: <https://code.djangoproject.com/ticket/22785#comment:1>
Comment (by danielsamuels):
Sorry, I chose a terrible title for this ticket. The main issue is that
for any `FormWizard` which isn't a `NamedUrlWizardView` you're able to
raise ValidationErrors and have those displayed on the form which failed.
When a form fails validation on a `NamedUrlWizard` you just get redirected
back to the form and any ValidationErrors which were raised get silently
discarded. This issue only really affects people who are overriding
`render_done`, raising a ValidationError and returning
`render_revalidation_failure()`.
--
Ticket URL: <https://code.djangoproject.com/ticket/22785#comment:2>
* status: closed => new
* resolution: needsinfo =>
Comment:
Okay, I'm not too familiar with the code. Can you propose a fix?
--
Ticket URL: <https://code.djangoproject.com/ticket/22785#comment:3>
Comment (by anonymous):
The way I fixed it in my project was to push the ValidationErrors into the
messages framework and then pull them out on the other side, not sure if
that's a valid solution for Django itself though.
--
Ticket URL: <https://code.djangoproject.com/ticket/22785#comment:4>
Comment (by timo):
I don't think so -- we wouldn't want to add coupling between the two
contrib apps.
--
Ticket URL: <https://code.djangoproject.com/ticket/22785#comment:5>
* status: new => closed
* resolution: => needsinfo
Comment:
Closing as "needs info" absent a proposal for how this should be addressed
-- if someone has a suggestion, please reopen.
--
Ticket URL: <https://code.djangoproject.com/ticket/22785#comment:6>
Comment (by thomasrumbold@…):
I don't mean to be unhelpful here - but as I understand it, this existing
issue has been closed because there hasn't been a proposal to fix it
within 12 days of it being submitted. That doesn't change the fact that it
exists. Surely the default would be to leave it open until further notice
and potentially, someone can contribute?
--
Ticket URL: <https://code.djangoproject.com/ticket/22785#comment:7>
Comment (by timo):
Yes, and I don't mean to be aggressive in closing it. I haven't studied
the issue, but I am not sure it is possible to fix in a general fashion
since the solution Daniel came up with involved using messages. We try to
keep open tickets actionable, so I would rather keep this closed until
someone decides it's possible to fix rather than keeping an open ticket
for something where no clear path of action exists. Are the two wizards
intended to work in the same way or is this simply a limitation of
`NamedUrlWizardView`?
--
Ticket URL: <https://code.djangoproject.com/ticket/22785#comment:8>
Comment (by danielsamuels):
As far as I'm aware all of the Wizards except `NamedUrlWizardView` handle
ValidationErrors correctly - because they re-render the form directly
instead of redirecting like `NamedUrlWizardView` does.
--
Ticket URL: <https://code.djangoproject.com/ticket/22785#comment:9>