#11806 closed (duplicate)
FormWizard.process_step() doesn't always have a validated Form.
Reported by: | kiowa | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.1 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The FormWizard documentation says:
FormWizard.process_step() Hook for modifying the wizard's internal state, given a fully validated Form object. The Form is guaranteed to have clean, valid data.
But the form isn't always guaranteed to be clean - and thus give access to its cleaned_data mapping.
To achieve this you will need in your process_step:
process_step(self, request, form, step): form.full_clean()
Change History (5)
comment:1 by , 15 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
follow-up: 3 comment:2 by , 15 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
in contrib/formtools/wizard.py
63 for i in range(current_step): 64 form = self.get_form(i, request.POST) 65 if request.POST.get("hash_%d" % i, '') != self.security_hash(request, form): 66 return self.render_hash_failure(request, i) 67 self.process_step(request, form, i)
line 67: form passed to self.process_step is _never_ cleaned (happens for all forms before current_step)
this is an old bug, I'm sure there are other tickets on this
follow-up: 4 comment:3 by , 15 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
comment:4 by , 15 years ago
Note:
See TracTickets
for help on using tickets.
You've stated that the form isn't always guaranteed to be clean without providing an example of how that could happen. Based on the documentation and a brief look at the code, that happening would seem to be a coding error rather than a documentation problem. So as written I believe this ticket is invalid. Feel free to reopen with specifics on how to recreate a situation where process_step is called without a valid form, but the place to look for fixing it I believe will be in the code, not the documentation.