Re: booleanfield and required = true

2007-11-15 Thread Malcolm Tredinnick
On Thu, 2007-11-15 at 06:47 -0800, Milan Andric wrote: > > > On Nov 9, 12:34 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: > > On Fri, 2007-11-09 at 06:26 +, Milan Andric wrote: > > > > > On Nov 9, 12:02 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > > > wrote: > > > > > Shouldn't the f

Re: booleanfield and required = true

2007-11-15 Thread Ken
I haven't quite figured this out myself but here's what I do. By default all form fields have required=True. So, specifying required=True is not necessary. If the default value is True, pre- check the checkbox with initial={'checkme': True}. If the default value is False, specify required=Fal

Re: booleanfield and required = true

2007-11-15 Thread Milan Andric
On Nov 9, 12:34 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2007-11-09 at 06:26 +, Milan Andric wrote: > > > On Nov 9, 12:02 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > > wrote: > > > > Shouldn't the form give errors and not validate? > > > > Nope. It's a bit tricky, though.

Re: booleanfield and required = true

2007-11-08 Thread Malcolm Tredinnick
On Fri, 2007-11-09 at 06:26 +, Milan Andric wrote: > > > On Nov 9, 12:02 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: > > > Shouldn't the form give errors and not validate? > > > > Nope. It's a bit tricky, though. The problem is that HTML forms do not > > send *anything* for a checkbo

Re: booleanfield and required = true

2007-11-08 Thread Milan Andric
On Nov 9, 12:02 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > Shouldn't the form give errors and not validate? > > Nope. It's a bit tricky, though. The problem is that HTML forms do not > send *anything* for a checkbox that you don't check. So missing data for > a checkbox field means it

Re: booleanfield and required = true

2007-11-08 Thread Malcolm Tredinnick
On Fri, 2007-11-09 at 05:40 +, Milan Andric wrote: > I might be misunderstanding the documentation about BooleanField. > http://www.djangoproject.com/documentation/newforms/#booleanfield > > but it seems if i have : > > >>> class Foo(forms.Form): > bool = forms.BooleanField(required=Tru

booleanfield and required = true

2007-11-08 Thread Milan Andric
I might be misunderstanding the documentation about BooleanField. http://www.djangoproject.com/documentation/newforms/#booleanfield but it seems if i have : >>> class Foo(forms.Form): bool = forms.BooleanField(required=True) >>> f=Foo({}) >>> f.is_valid() True >>>f.cleaned_data {'b': False}