Ticket #11860: nullbooleanselect_patch.diff
File nullbooleanselect_patch.diff, 1.5 KB (added by , 15 years ago) |
---|
-
django/forms/widgets.py
452 452 False: False}.get(value, None) 453 453 454 454 def _has_changed(self, initial, data): 455 # Sometimes data or initial could be None or u'' which should be the 456 # same thing as False. 457 return bool(initial) != bool(data) 455 # For a NullBooleanSelect, None (unknown) and False (No) 456 # are not the same 457 if initial is not None: 458 initial = bool(initial) 459 if data is not None: 460 data = bool(data) 461 return initial != data 458 462 459 463 class SelectMultiple(Select): 460 464 def render(self, name, value, attrs=None, choices=()): -
tests/regressiontests/forms/widgets.py
532 532 <option value="2">Yes</option> 533 533 <option value="3" selected="selected">No</option> 534 534 </select> 535 >>> w._has_changed(False, None) 536 True 537 >>> w._has_changed(None, False) 538 True 539 >>> w._has_changed(None, None) 540 False 541 >>> w._has_changed(False, False) 542 False 543 >>> w._has_changed(True, False) 544 True 545 >>> w._has_changed(True, None) 546 True 547 >>> w._has_changed(True, True) 548 False 535 549 536 550 """ + \ 537 551 r""" # [This concatenation is to keep the string below the jython's 32K limit].