Skip to content

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

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy