Skip to content

Why is the value of a Checkbox forced to None? #182

@ljean

Description

@ljean

The _format_value of a CheckBoxInput returns None if value is valid (True or False) .

See Line 446

def _format_value(self, value):
        if value in ('', True, False, None):
            value = None
        else:
            value = force_text(value)
        return value

Why don't keep the value as it is rather than returning None? I think this cause a different behavior from other field types.

In my case, it caused a bug when upgrading an application and it was very difficult to find.

Thanks for explaining the reason.

Best
luc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions