﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32622	BooleanField raises ValidationErrors when passing False	Tonye Jack	nobody	"The current django form BooleanField fails when passing False.


{{{
class BooleanField(Field):
    widget = CheckboxInput

    def to_python(self, value):
        """"""Return a Python boolean object.""""""
        # Explicitly check for the string 'False', which is what a hidden field
        # will submit for False. Also check for '0', since this is what
        # RadioSelect will provide. Because bool(""True"") == bool('1') == True,
        # we don't need to handle that explicitly.
        if isinstance(value, str) and value.lower() in ('false', '0'):
            value = False
        else:
            value = bool(value)
        return super().to_python(value)

    def validate(self, value):
        if not value and self.required:  # <--- Source of the error this should likely use `if value is not None and self.required`
            raise ValidationError(self.error_messages['required'], code='required')
}}}
"	Uncategorized	closed	Forms	3.2	Normal	duplicate	forms,		Unreviewed	0	0	0	0	1	0
