Hi,

On Jul 24, 8:41 am, Matthias Kestenholz
<matthias.kestenh...@gmail.com> wrote:

> if request.method == 'POST':
>     # initialize forms with request.POST and prefix
>     if form1.is_valid() and form2.is_valid() and form3.is_valid():
>         # save the data from the individual forms
> else:
>     # ....
>

Just a little remark, as I hit this stumbling block a couple of days
ago: if you validate the forms like this (f1.is_valid() and f2.is_valid
() and ...) and your first form is not valid, Python will short cut
the if statement and not call is_valid on the other forms, which isn't
generally what you want in this situation. This works better:

if all(f.is_valid() for f in (form1, form2, form3)):
    # ok, save

Regards,
Benjamin
--~--~---------~--~----~------------~-------~--~----~
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