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

Fixed #2761 - ListField truncation on HTTP PATCH #3415

Merged
merged 2 commits into from Sep 21, 2015

Conversation

adamsc64
Copy link
Contributor

@adamsc64 adamsc64 commented Sep 19, 2015

  • Previously, partial serialization during an update request, such as in the case of HTTP PATCH, would have truncated any old values in ListField data. This is because it had relied on the default value of an empty list. But an empty list has different functionality than the sentinel value of empty. Namely, the semantic meaning of an empty list on an update is to remove all the values. Instead, this PR changes validation internals to use the sentinel value of empty instead of an empty list.
  • Included minor refactor of both ListField and MultipleChoiceField, for the sake of consistent code.
  • Included proof of bug in a unit test at cb42b99.
  • Should resolve Issue PATCH with no data is updating ListField values on ModelSerializer instead of leaving them alone #2761.

adamsc64 added 2 commits Sep 19, 2015
- When not submitting key for list fields or multiple choice, partial
  serialization should result in empty state (key not there), not an
  empty list.
- Checked ``partial`` state when getting value in appropriate field
  classes; return ``empty`` immediately if key not submitted.
@xordoquy xordoquy added the Bug label Sep 21, 2015
@xordoquy xordoquy added this to the 3.2.5 Release milestone Sep 21, 2015
xordoquy added a commit that referenced this pull request Sep 21, 2015
Fixed #2761 - ListField truncation on HTTP PATCH
@xordoquy xordoquy merged commit f2c6551 into encode:master Sep 21, 2015
@xordoquy
Copy link
Collaborator

xordoquy commented Sep 21, 2015

Good job ! Thanks for the PR.

@xordoquy xordoquy modified the milestones: 3.2.4 Release, 3.2.5 Release Sep 21, 2015
xordoquy added a commit to linovia/django-rest-framework that referenced this pull request Sep 21, 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.

None yet

2 participants