Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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.
@lovelydinosaur lovelydinosaur added this to the 3.0.5 Release milestone Jan 28, 2015
lovelydinosaur added a commit that referenced this pull request Jan 28, 2015
 ManyRelatedField.get_value clearing field on partial update
@lovelydinosaur lovelydinosaur merged commit 6d89430 into encode:master Jan 28, 2015
@lovelydinosaur
Copy link
Contributor

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