-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Hyperlinked PK optimization. #2242
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
@@ -197,7 +199,8 @@ def test_foreign_key_retrieve(self): | |||
{'url': 'http://testserver/foreignkeysource/2/', 'name': 'source-2', 'target': 'http://testserver/foreignkeytarget/1/'}, | |||
{'url': 'http://testserver/foreignkeysource/3/', 'name': 'source-3', 'target': 'http://testserver/foreignkeytarget/1/'} | |||
] | |||
self.assertEqual(serializer.data, expected) | |||
with self.assertNumQueries(1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this fix, this is 4.
This looks reasonable to me! Definitely cleaner than the existing workarounds in |
👍 |
TODO: Confirm interaction between |
Also possible - drop the |
The
https://docs.djangoproject.com/en/1.7/ref/models/queries/#prefetch-objects This seems good to go now tho. |
Hyperlinked PK optimization.
Closes #1872.