> > Looking at the code for forms.fields.BooleanField and > forms.fields.NullBooleanField I guess the change would be in to_python > in the latter to check in the case where it would return None if > self.required is true and raise the validation error if that's the > case (i.e. similar to what BooleanField.to_python does for values of > False).
As an aside, I'm now wondering if it's actually incorrect in Django 1.2 that BooleanField.to_python is what does the self.required check - shouldn't it be done in a method called validate? The documentation for the field api for 1.2 says "the to_python() method on a Field is the first step in every validation, it coerces the value to correct datatype and raises ValidationError if that is not possible" - I'd argue that False is of the correct data type (i.e. just because required is set to True doesn't mean that False now is not of the correct data type for BooleanField) so to_python shouldn't be doing this check. I think it's probably an oversight as the code that's now in "to_python" on BooleanField in 1.2 is what was in "clean" in 1.1, so it was probably just moved wholesale. Matt -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.