On Fri, Jul 24, 2009 at 10:46 AM, Benjamin Wohlwend<piquad...@gmail.com> wrote: > > On Jul 24, 10:37 am, Benjamin Wohlwend <piquad...@gmail.com> wrote: > >> >> if all(f.is_valid() for f in (form1, form2, form3)): >> # ok, save >> > > Oops, forgot to mention that I had to implement my own version of all > (), which doesn't short cut: > > def really_all(iter): > all_true = True > for val in iter: > if not val: > all_true = False > return all_true
There is a function in Django proper which does exactly that: django.forms.formsets.all_valid Since is_valid works the same for forms and formsets you can use this for plain forms too. Matthias --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---