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

BooleanField default values not used when an empty POST is sent #3892

Closed
callorico opened this issue Feb 2, 2016 · 0 comments · Fixed by #4566
Closed

BooleanField default values not used when an empty POST is sent #3892

callorico opened this issue Feb 2, 2016 · 0 comments · Fixed by #4566

Comments

@callorico
Copy link
Contributor

Seems related to #3811 and #3788.

When I make a POST with an empty body to a view that is using a serializer that contains a BooleanField that has its default kwarg set to a callable, I am getting the following validation error returned:

{"flag":["\"<function <lambda> at 0x1069fbb18>\" is not a valid boolean."]}

Even though I am explicitly setting the content type in the request to application/json, the html.is_html_input method is returning true on the data dict. This causes the BooleanField.default_empty_html value to be returned from BooleanField.get_value. default_empty_html seems to be set to the Field's default value in this case which is the callable object. This produces a rather strange validation error message.

Failing test case here: #3891

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants