I'm still working on forming some sort of understanding of what exactly
causes this and/or what is even going on, so any help is much appreciated.
The resultant attached "bars" in the following example:
queryset = Foo.objects.all()
queryset = queryset.prefetch_related('bars__baz')
obj = queryset.get(pk=1)
are different from the results of:
obj = Foo.objects.all().prefetch_related('bars__baz').get(pk=1)
And, the results attached in the second example are inconsistent as well.
In order to reproduce this, you need to first query for the "Foo", then add
some "bars" to the DB, then perform the above examples.
This only seems to occur, at least measurably, during tests when using
``self.client.get(...``, where the view that is being requested performs
the queries.
I'm using ``TransactionTestCase``, sqlite3, and Django latest master,
pulled about an hour ago, and I've also tried the new live server test case
with the same results.
Note: If I modify django.db.models.query # 590 to the following, the bug
doesn't occur (not to suggest that the following is a solution, but it
might help to debug):
prefetch_related_objects([], self._prefetch_related_lookups)
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-developers/-/qpkxQFmjlvoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en.