Monday, October 31, 2011

Re: new formwizard - how to pass data between forms

Hey Kurtis,

thanks for your answer.

I think hidden fields were used in the old implementation.
At least the release notes for 1.4 say:
"It features a pluggable storage API and doesn't require the wizard to
pass around hidden fields for every previous step."
But checking the example apps (https://github.com/stephrdev/django-
formwizard/blob/master/test_project/testapp2/views.py#L20
) i found
what i was looking for:
get_cleaned_data_for_step()

It does exactly what i need :-)

On 31 Okt., 03:07, Kurtis Mullins <kurtis.mull...@gmail.com> wrote:
> I haven't read that particular back ports docs but when I looked at the dev docs for the new form wizard a little while back, I believe that it stores all previous data as hidden fields throughout the process. So I would think form.cleaned_data should contain everything. Hopefully that helps a little :)
>
> Sent from my iPad
>
> On Oct 29, 2011, at 11:19 AM, andreas <dal...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi all,
>
> > i am using the backport of django's new formwizard (https://github.com/
> > stephrdev/django-formwizard).
> > and i am looking for the recommended way to pass data between the
> > different forms/steps.
>
> > Basically i am using the formwizard to process a series of forms that
> > let the user (further) specify filter options from step to step.
> > For example in the first step you would choose from a list of
> > countries, the next form would give you the states form these
> > countries and the final result of the wizard (done()) renders a list
> > of the major cities in these states.
>
> > If i use get_form_kwargs (https://docs.djangoproject.com/en/dev/ref/
> > contrib/formtools/form-wizard/
> > #django.contrib.formtools.wizard.views.WizardView.get_form_kwargs) i
> > can access the data from the previous step via self.request.POST and
> > pass   the selected choices to the form constructor of the next form
> > where i then filter the choices of the relevant field.
>
> > But is it also possible to access the selected data fron step 1 in
> > step4?
> > Something like get_all_cleaned_data() but just for the processed
> > steps?
>
> > --
> > 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+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment