Opened 12 years ago
Last modified 12 years ago
#19537 closed Bug
Widget CheckboxInput show_hidden_initial _has_changed bug — at Initial Version
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | 1.4 |
Severity: | Normal | Keywords: | show_hidden_initial |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
django.forms.CheckboxInput
have method
def _has_changed(self, initial, data):
# Sometimes data or initial could be None or u which should be the
# same thing as False.
return bool(initial) != bool(data)
initial may be u'False' or u'True'
bool(initial) always return True for unicode len(initial) > 1
if initial == u'False' and data == u'on' always return False
bool(u'False') = True
bool(u'on') = True
path:
def _has_changed(self, initial, data):
initial = True if initial == u'True' else False
return initial != bool(data)