diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 1fbef98..172bb3c 100644
a
|
b
|
class TimeInput(Input):
|
487 | 487 | pass |
488 | 488 | return super(TimeInput, self)._has_changed(self._format_value(initial), data) |
489 | 489 | |
| 490 | |
| 491 | # Purposely defined at module level so it is picklable (unlike lambdas or methods) |
| 492 | def boolean_check(v): |
| 493 | return not (v is False or v is None or v == '') |
| 494 | |
490 | 495 | class CheckboxInput(Widget): |
491 | 496 | def __init__(self, attrs=None, check_test=None): |
492 | 497 | super(CheckboxInput, self).__init__(attrs) |
493 | 498 | # check_test is a callable that takes a value and returns True |
494 | 499 | # if the checkbox should be checked for that value. |
495 | 500 | if check_test is None: |
496 | | self.check_test = lambda v: not (v is False or v is None or v == '') |
| 501 | self.check_test = boolean_check |
497 | 502 | else: |
498 | 503 | self.check_test = check_test |
499 | 504 | |
diff --git a/tests/regressiontests/forms/tests/fields.py b/tests/regressiontests/forms/tests/fields.py
index 6e4a544..2ad0f17 100644
a
|
b
|
Other than that, the Field subclasses have class-specific options for
|
25 | 25 | __init__(). For example, CharField has a max_length option. |
26 | 26 | """ |
27 | 27 | import datetime |
| 28 | import pickle |
28 | 29 | import re |
29 | 30 | import os |
30 | 31 | import warnings |
… |
… |
class FieldsTests(SimpleTestCase):
|
698 | 699 | self.assertEqual(False, f.clean('false')) |
699 | 700 | self.assertEqual(False, f.clean('FaLsE')) |
700 | 701 | |
| 702 | def test_boolean_picklable(self): |
| 703 | self.assertIsInstance(pickle.loads(pickle.dumps(BooleanField())), BooleanField) |
| 704 | |
701 | 705 | # ChoiceField ################################################################# |
702 | 706 | |
703 | 707 | def test_choicefield_1(self): |