Commit Graph

18 Commits

Author SHA1 Message Date
Simon Charette 33d1dc2eeb [1.7.x] Fixed flake8 warnings introduced in recent commits.
Backport of 79f05616fb from master
2014-04-20 13:10:52 -04:00
valtron 6b3a8d2705 [1.7.x] Fixed #21760 -- prefetch_related used an inefficient query for reverse FK.
Regression introduced by commit 9777442. Refs #21410.

Backport of d3b71b976d from master
2014-04-13 00:51:38 +07:00
Loic Bistuer 7bbb6958dc Allowed custom querysets when prefetching single valued relations
The original patch for custom prefetches didn't allow usage of custom
queryset for single valued relations (along ForeignKey or OneToOneKey).
Allowing these enables calling performance oriented queryset methods like
select_related or defer/only.

Thanks @akaariai and @timgraham for the reviews. Refs #17001.
2014-03-03 21:35:19 +02:00
Aymeric Augustin e32095616c Imported override_settings from its new location. 2013-12-23 21:37:56 +01:00
Loic Bistuer 6685713869 Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
Loic Bistuer cb83448891 Fixed #21410 -- prefetch_related() for ForeignKeys with related_name='+'
Regression introduced by commit 9777442.

Thanks to trac username troygrosfield for the report and test case.
2013-11-13 07:35:34 +02:00
Tim Graham 536c447820 Fixed a couple flake8 warnings. 2013-11-07 20:10:25 -05:00
Loic Bistuer f51c1f5900 Fixed #17001 -- Custom querysets for prefetch_related.
This patch introduces the Prefetch object which allows customizing prefetch
operations.

This enables things like filtering prefetched relations, calling select_related
from a prefetched relation, or prefetching the same relation multiple times
with different querysets.

When a Prefetch instance specifies a to_attr argument, the result is stored
in a list rather than a QuerySet. This has the fortunate consequence of being
significantly faster. The preformance improvement is due to the fact that we
save the costly creation of a QuerySet instance.

Thanks @akaariai for the original patch and @bmispelon and @timgraham
for the reviews.
2013-11-07 14:49:49 +02:00
Alex Gaynor 9d740eb8b1 Fix all violators of E231 2013-10-26 12:15:03 -07:00
Tim Graham 96d1d4e292 Removed unused local variables in tests. 2013-10-19 08:31:38 -04:00
Alasdair Nicol a800036981 Fixed #21287 -- Fixed E123 pep8 warnings 2013-10-18 10:07:39 +01:00
Alasdair Nicol bab9123daa Fixed #21268 -- Fixed E303 pep8 warnings 2013-10-18 01:46:24 +01:00
Alasdair Nicol dfb4cb9970 Fixed #21285 -- Fixed E121,E122 pep8 warnings 2013-10-17 20:20:11 -04:00
Tim Graham b67ab75e82 Fixed assorted flake8 errors. 2013-10-11 07:25:14 -04:00
Claude Paroz 5c1143910e Removed most of absolute_import imports
Should be unneeded with Python 2.7 and up.
Added some unicode_literals along the way.
2013-07-29 20:28:13 +02:00
Tim Graham a2967d5204 Fixed #20242 - Added a regression test for prefetch_related.
Issue was fixed by removal of chunked reads from
QuerySet iteration in 70679243d1.

Thanks Simeon Visser for the patch.
2013-05-28 13:37:44 -04:00
Luke Plant 4fd94969d8 Fixed #19607 - prefetch_related crash
Thanks to av@rdf.ru and flarno11@yahoo.de for the report.
2013-05-24 11:10:48 +01:00
Florian Apolloner 89f40e3624 Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00