Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
archivarius888 opened this issue Dec 15, 2014 · 0 comments · Fixed by #2294
Closed

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

archivarius888 opened this issue Dec 15, 2014 · 0 comments · Fixed by #2294
Labels
Milestone

Comments

@archivarius888
Copy link

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.

@tomchristie tomchristie added this to the 3.0.2 Release milestone Dec 17, 2014
@tomchristie tomchristie changed the title 'default_empty_html' ignores 'default' attributes by BooleanField/CharField DRF 3.0.х Fix empty HTML values when a default is provided. Dec 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants