Skip to content

Allow partial update with polymorphic serializers #655

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

Conversation

charlieallatson
Copy link
Contributor

@charlieallatson charlieallatson commented Jun 6, 2019

Description of the Change

Passes the partial argument to the subclass of a polymorphic serializer when to_internal_value is called. This prevents a validation error being raised if you don't provide all fields when making a PATCH request to the resource.

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • author name in AUTHORS

@sliverc
Copy link
Member

sliverc commented Jun 7, 2019

Thanks for your PR. Could you add a test to ensure that this fix works and a changelog entry? Thanks.

@codecov
Copy link

codecov bot commented Jun 7, 2019

Codecov Report

Merging #655 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #655   +/-   ##
=======================================
  Coverage   96.13%   96.13%           
=======================================
  Files          56       56           
  Lines        2869     2869           
=======================================
  Hits         2758     2758           
  Misses        111      111

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b884535...6b51632. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 7, 2019

Codecov Report

Merging #655 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #655      +/-   ##
==========================================
+ Coverage   96.13%   96.14%   +0.01%     
==========================================
  Files          56       57       +1     
  Lines        2869     2879      +10     
==========================================
+ Hits         2758     2768      +10     
  Misses        111      111
Impacted Files Coverage Δ
example/tests/integration/test_polymorphism.py 100% <100%> (ø) ⬆️
example/models.py 100% <100%> (ø) ⬆️
example/migrations/0007_artproject_description.py 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cac09bd...f0211f5. Read the comment docs.

@sliverc sliverc force-pushed the bugfix/polymorphic-partial-update branch from 6b51632 to f0211f5 Compare June 7, 2019 15:09
Copy link
Member

@sliverc sliverc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. LGTM.

@sliverc sliverc changed the title Fix polymorphic partial update Allow partial update with polymorphic serializers Jun 8, 2019
@sliverc sliverc merged commit 21600c6 into django-json-api:master Jun 8, 2019
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