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

ManyRelatedField.get_value clearing field on partial update #2475

Merged
merged 3 commits into from
Jan 28, 2015

Conversation

sdreher
Copy link
Contributor

@sdreher sdreher commented Jan 27, 2015

A PATCH to a serializer's non-related CharField was clearing an ancillary StringRelatedField(many=True) field.
The issue appears to be in the ManyRelatedField's get_value method, which was returning a [] instead of empty
when the request dictionary was a MultiDict.

This fix mirrors code in fields.py, class Field, get_value, Ln. 272, which explicitly returns empty on a partial update.

Tests added to demonstrate the issue.

A PATCH to a serializer's non-related CharField was clearing an ancillary StringRelatedField(many=True) field.
The issue appears to be in the ManyRelatedField's get_value method, which was returning a [] instead of empty
when the request data was a MultiDict.

This fix mirrors code in fields.py, class Field, get_value, Ln. 272, which explicitly returns empty on a partial update.

Tests added to demonstrate the issue.
@tomchristie tomchristie added this to the 3.0.5 Release milestone Jan 28, 2015
tomchristie added a commit that referenced this pull request Jan 28, 2015
 ManyRelatedField.get_value clearing field on partial update
@tomchristie tomchristie merged commit 6d89430 into encode:master Jan 28, 2015
@tomchristie
Copy link
Member

Looks good. Thanks!

sdreher added a commit to ccnmtl/footprints that referenced this pull request Nov 25, 2015
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 this pull request may close these issues.

2 participants