Skip to content

Resetting a CharFiled to an empty string after fix for #3130 #3318

Closed
@mkemmerling

Description

@mkemmerling

Commit d231f36 to fix #3130 added the following check to fields.Field.get_value():

        elif ret == '' and self.default:
            return empty

Maybe I am wrong, but it looks like with this change it is no longer possible to reset a CharField with allow_blank=True but no default argument which currently has a non-empty value back to an empty string: The default value for the default argument is the empty marker. Since the validate_empty_values() method raises a SkipField execption for this marker the field is skipped on update if set to an empty string.

To work around this problem the field may be defined with the empty string as default argument, but to have both allow_blank=True and default='' in the field's argument list seems counter-intuitive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions