Since FormWizard is instantiated only once (in the urlconf, as
proposed in the documentation), no assumptions can be made about the
integrity and validity of its instance methods/attributes. It is very
easy to run into a situation, when self.form_list is altered and not
restored to a value, with which the FormWizard was initialized.
self.extra_context is also available at all times and doesn't get
cleaned up.

The question is, how to store the state inside the step and between
the steps?

For intra-step state (for example, if I want to set something in
parse_params and then access it in process_step) it seems rather
trivial, - just set an instance attribute and unset it later. This is,
however, not safe, because if something goes wrong during the
__call__, that attribute will not get unset. Nevertheless, it is not
so hard to implement, I guess.

What about inter-step state, though? I don't see an easy way to do it.
At first, I thought, that instance attributes are ok to use for this,
but then I've of course realized, that once FormWizard is initialized
in the urlconf, there will be only one of it, ever (__call__ will get
called, but that's it - there will be only once instance).

One possible way to work with it is sessions, but they have their own
limitations, - you cannot store unpicklable objects in them (so you
can't store a model or a curried function inside a session, right?). I
guess, this is all I can think of right now.


Just to sparkle your imagination, the desired workflow of a FormWizard
I am trying to implement is as follows: Form1 -> Form2 (must be
dynamically set based on the submitted values in Form1) -> Form3 (show
a preview of pending changes to the user) -> done() (apply the
changes). I know, it sounds a bit complicated, but that is the way it
*has* to be.

Obviously, the best way to work with it would be actually generating
the resultant changes as curried functions with attached descriptions,
that can be shown to the user, somehow pass them between the steps and
then actually call those functions in done(). This, however, seems
impossible to implement.


I'd be most grateful, if someone could give me an idea or two or, at
least, point me into a right direction.

Mark
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to