In the done() method you are provided with a list of the validated
forms so you can just do:

for form in form_list:
    form.save()

before returning your response

2008/9/17 Martin <[EMAIL PROTECTED]>:
>
> Greetings,
>
> i'm playing with FormWizard and i'm having some problem saving each
> step into the database. I think this should be pretty straightforward,
> but i guess i'm doing something wrong.
>
> I have two models and corresponding forms:
> --------------------------------------------------------
> class Sender(models.Model)
>  first_name = models.CharField()
>  surrname = models.CharField()
>  address = models.CharField()
>
> class Receiver(models.Model)
>  first_name = models.CharField()
>  surrname = models.CharField()
>  address = models.CharField()
>
> class SenderForm(ModelForm)
>
> class ReceiverForm(ModelForm)
>
> then i combine those two forms with formwizard:
> class PismoWizard(FormWizard):
>        def done(self, request, form_list):
>
> return HttpResponseRedirect('/send/thanks/')
>
> -------------------------------------
> so far i've done this:
>                        form_list[1] = SenderForm(request.POST)
>                        if form_list[1].is_valid():
>                                sender = SenderForm()
>                                form_list[1].instance = sender
>                                super(SenderForm, self).save()
>
> but this obviously doesn't work, because it doesn't store an entry
> into the database..
> ------------------------------------
> so my question here is, how do you save each step (of the formwizard)
> to the database, since each step has it's own database table?
> my other question is, can you display a form (which is not ModelForm)
> and at the end, save some fields into model A, some into model B and
> some in C?
> I know this questions are little wierd, but i only want some
> suggestion on how to approach this problem.
>
> Thanks, martin
> >
>

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

Reply via email to