CheckboxInput don't work with 0 and 1 value (considerd as Booleans)
|Reported by:||alexis_m||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I think I've discovered an unwanted behavior in the "render" method of the CheckboxInput class, or maybe I don't understand how it's designed to be used.
When using the render() method, with a value of 0 or 1, the verification process, made by the following code:
if value not in ('', True, False, None):
prevents the "value" attribute to be shown.
It's mainly because 1 and 0 are considéred equals to True and False.
Here is my proposition to solve this:
if (value not in ('', None)) and str(value) not in ('False', 'True'):
Another option can be to use force_unicode from from django.utils.encoding on incoming values.