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 default values always being False for browsable API #1291

Merged
merged 1 commit into from
Dec 13, 2013
Merged

Fix default values always being False for browsable API #1291

merged 1 commit into from
Dec 13, 2013

Conversation

kevin-brown
Copy link
Member

This fixes a bug introduced in 28ff6fb that caused the default value for BooleanFields to be overridden when form data is passed to the serializer. While #1248 already exists, and does fix the issue (somewhat, I'll post the issues there later), this fixes it at the source of the problem.

/cc @tomwalker

This fixes a bug that was introduced in 28ff6fb [1] for the
browsable API, specifically with how it handled default values
for boolean fields.  Previously, it had a global default for
boolean fields set to `False`, which was different than the
standard None that was used elsewhere.  Because this only needed
to be done for the browsable API, a fix was put into place that
only set the default to `False` when form data was passed into
the serializer.  This had the unintended side effect of overriding
any default set on the boolean field.

This fixes #1101 [2] by only overriding the default if the default is
`None`, which is the default for all fields.

[1]: 28ff6fb
[2]: #1101
tomchristie added a commit that referenced this pull request Dec 13, 2013
Fix default values always being False for browsable API
@tomchristie tomchristie merged commit 8b2f0cc into encode:master Dec 13, 2013
@tomchristie
Copy link
Member

Thanks @kevin-brown

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

Successfully merging this pull request may close these issues.

2 participants