Skip to content

Fix empty HTML values when a default is provided. #2280

Closed
@archivarius888

Description

@archivarius888

Attribute 'default_empty_html' by BooleanField/CharField ignores 'default'/'allow_blank'.
For example, if we get empty data, all Boolean instance has False, all CharField has ''.

  for field in fields:
        validate_method = getattr(self, 'validate_' + field.field_name, None)
        primitive_value = field.get_value(data)
        try:
            validated_value = field.run_validation(primitive_value)
        ...

  def get_value(self, dictionary):
        ...
        if self.field_name not in dictionary:
            ....
            return self.default_empty_html
        ...

I guess 'default_empty_html' should be empty.

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