Skip to content

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?

@lovelydinosaur lovelydinosaur 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