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 pk-only optimization for properties #7142

Merged
merged 2 commits into from
Sep 3, 2020

Conversation

rpkilby
Copy link
Member

@rpkilby rpkilby commented Jan 15, 2020

Adjusts the related field pk-only optimization check to also handle properties. Should fix #6643 as well as #4653. Tests were adapted from #2690, but didn't include the hyperlink tests, since I don't think they're necessary here.

In regards to #2690 (comment), I'm not too worried about the tests model changes, since the rest of the test module fairly heavily relies on them. I'm not worried about impact either, since the method/prop won't have an impact on other model serializer tests. Thoughts?

@tomchristie tomchristie merged commit f323049 into encode:master Sep 3, 2020
@rpkilby rpkilby deleted the fix-related-prop branch September 4, 2020 09:43
sigvef pushed a commit to sigvef/django-rest-framework that referenced this pull request Dec 3, 2022
* Add callable/prop tests for pk-only optimization

* Fix related field pk-only optimization for props
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.

PrimaryKeyRelatedField from property method wrongly generates PKOnlyObject
4 participants