Skip to content

Conversation

@n2ygk
Copy link
Contributor

@n2ygk n2ygk commented Nov 12, 2018

Fixes #489

Description of the Change

Fixes incorrect PKOnly optimization for a toOne relationship by overriding use_pk_only_optimization in RelatedMixin.get_related_instance.

This behavior is selectable by overriding the RelatedMixin.override_pk_only_optimization feature flag which is used to demonstrate the bug in the test case code. After some time with no issues identified, we should consider removing this feature flag.

See #492 for further discussion.

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated (via docstrings)
  • changelog entry added to CHANGELOG.md
  • author name in AUTHORS

…`retrieve_related` of a to-one relationship
@n2ygk n2ygk requested a review from sliverc November 12, 2018 20:10
@sliverc
Copy link
Member

sliverc commented Nov 16, 2018

I have taken some time to read into this issue.

Monkey patching is always risky as it might cause side effects. I have written a bit of a different patch at #517 which fixes the issue without monkey patching and also uses the existing tests environment to reproduce the issue.

Best have a look there. Closing this PR in favor of #517

@sliverc sliverc closed this Nov 16, 2018
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