In general, you want to validate every datum on every request.
This prevents people from modifying the hidden fields used to
hold the 1st form when they submit the 2nd form. However, as you
describe, it might not be feasible if some complex calculation
occurs. A couple possibilities that occur to me:
You could only clean the 1st form if you're coming from the 2nd
form (skip cleaning on the 1st form). That saves you from doing
it the 1st time rather than the 2nd time. However, if your 2nd
form depends on trusting information in the first form, this
won't work.
Alternatively, you could add a secured MD5/SHA1 hash to the be
included in the hidden fields that verifies that the given data
has been cleaned already. You would combine all your fields, a
salt, and a secret in a predictable order, and then get the
MD5/SHA1 of that content. Then instead of whatever your
complicated check is, you can just recombine your fields, your
salt, and your secret (in the same order), and check the MD5/SHA1
hash across them. If they match, all is good. If they don't
match, the user has altered the hidden form data and you can
either error out, or do the recalculation of the first form.
-tim
all the forms are validated before passed to the done() method so that
it can expect cleaned data to be present on all of them.
in every step, only the currently submitted form is validated, just in
the last one, before done() is called, every single form is cleaned so
that done() doesn't have to do this.
Originally this wasn't there but I found out that every single
subclass of Wizard I wrote had done() starting in the same way -
cleaning all the forms so that I could access cleaned_data.
does this answer your question?
--
Honza Král
E-Mail: Honza...@gmail.com
ICQ#: 107471613
Phone: +420 606 678585
but it may be easier just to do it yourself in a view without the Wizard... ;)
--
Honza Král
E-Mail: Honza...@gmail.com