diff --git a/docs/index.rst b/docs/index.rst index f6082f3..7a7009d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -21,6 +21,7 @@ Contents: gettingstarted namedformwizard + uniquesessionformwizard apireference Indices and tables diff --git a/docs/uniquesessionformwizard.rst b/docs/uniquesessionformwizard.rst new file mode 100644 index 0000000..5fdaa59 --- /dev/null +++ b/docs/uniquesessionformwizard.rst @@ -0,0 +1,27 @@ +=============================== +django-formwizard UniqueSessionFormWizard Documentation +=============================== + +A problem with the stock SessionFormWizard is that a user may only engage a single wizard at anyone time. If during the processes of filling out a SessionFormWizard the user opens a secondary browser-tab or window and accesses the same form, the state of the first form is destroyed. + +UniqueSessionFormWizard and UniqueSessionFormWizardProvider solve this by providing each new form a unique identifier. Instead of associating a URL with a single *FormWizard we instead point it as UniqueSessionFormWizardProvider. The provider will maintain a registry of active forms and assuming each POST request contains the corresponding UID the user will now be able to engage multiple forms simultaneously. + +The URL configuration is very similar but note the difference:: + + from formwizard import forms + provider_instance = forms.UniqueSessionFormWizardProvider( + UniqueSessionFormWizard, + [Form1, Form2, ModelForm1]) + + urlpatterns = patterns('', + url(r'^$', provider_instance),) + +First we initialize a provider with the FormWizard class we wish to use and of course the list of forms the wizard will use. We point the URL at the provider. Any GET request to this URL will initialize a new unique form wizard. Subsequent POST requests should include the session key which is provided to the template:: + +