1
0
mirror of https://github.com/django/django.git synced 2025-07-05 18:29:11 +00:00

4030 Commits

Author SHA1 Message Date
Malcolm Tredinnick
7292cc8d60 queryset-refactor: Reverted [6762] because it generates invalid SQL. It only worked accidentally with SQLite.
Refs #4002.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6961 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-19 13:06:45 +00:00
Malcolm Tredinnick
4dc766c9e1 queryset-refactor: Tweaked quote_name_if_not_alias() slightly.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6960 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-19 13:06:16 +00:00
Malcolm Tredinnick
470ddafe97 queryset-refactor: Made qs.dates(...).count() work.
This involved a slight change in the SQL for .dates() which appears to be
correct and passes all the tests, but may have some side-effect I don't know
about.

Refs #6203.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6959 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-19 12:23:59 +00:00
Malcolm Tredinnick
18adbb6363 queryset-refactor: Fixed the way join promotions are done when joining queries (particularly the disjunctive -- 'OR' -- case). This fixes a FIXME and produces better queries.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6958 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-19 10:58:26 +00:00
Malcolm Tredinnick
519178154b queryset-refactor: Fixed a problem when adding certain additional filters to a queryset that has precisely one filter attached already.
Refs #6154.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6957 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-19 10:57:54 +00:00
Malcolm Tredinnick
97091940b1 queryset-refactor: Merged from trunk up to [6953].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6954 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-19 05:08:37 +00:00
Malcolm Tredinnick
13d3162aaf queryset-refactor: Added a test to show that various Q() combinations work when the same field with different lookup types are combined. Refs #4289.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6901 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-09 08:01:26 +00:00
Malcolm Tredinnick
3064a211bf queryset-refactor: Allow specifying of specific relations to follow in
select_related(). Refs #5020.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6899 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-09 06:24:17 +00:00
Malcolm Tredinnick
3dce17ddc4 queryset-refactor: Fixed a couple of differences between trunk and this branch that were caused by merge errors.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6896 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-05 09:40:16 +00:00
Malcolm Tredinnick
0d7b6884df queryset-refactor: Added a FIXME for something I just remembered.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6869 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-03 21:23:15 +00:00
Malcolm Tredinnick
8e6126fbc2 queryset-refactor: Fixed disjunctions of empty result sets. Refs #6074.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6868 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-03 21:10:55 +00:00
Malcolm Tredinnick
57a4b882ae queryset-refactor: Fixed query disjunctions.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6867 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-03 21:10:51 +00:00
Malcolm Tredinnick
cc0078494e queryset-refactor: Changed all tree and filter "connections" to "connectors" so
that database connections and constraint connectors look different in the code.
George Vilches pointed out this was slightly confusing previously.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6866 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-03 21:10:41 +00:00
Malcolm Tredinnick
4ea96c0468 queryset-refactor: Changed execute_sql() to not return an iterator in the
non-MULTI cases when there is an empty result set.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6860 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-03 03:31:26 +00:00
Malcolm Tredinnick
7b9732a4a4 queryset-refactor: Added a test for #6074 so that it gets fixed.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6859 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-03 03:31:18 +00:00
Malcolm Tredinnick
2c5373c325 queryset-refactor: Changed maxlength to max_length in a couple of tets. Silences some deprecation warnings.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6858 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-03 03:00:03 +00:00
Malcolm Tredinnick
07ddd56872 queryset-refactor: Merged from trunk up to [6856].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6857 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-03 02:59:56 +00:00
Malcolm Tredinnick
79653a4148 queryset-refactor: Implemented filtering by output columns specified in
extra(select=...). Refs #4002.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6762 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-30 04:44:32 +00:00
Malcolm Tredinnick
a2418176fd queryset-refactor: Interpret qs.filter(foo=None) to be the same as qs.filter(foo__isnull=True). Refs #2737.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6760 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-30 02:29:25 +00:00
Malcolm Tredinnick
648a3d87a3 queryset-refactor: Fixed some Python 2.3 problems.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6756 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 22:08:04 +00:00
Malcolm Tredinnick
bef4ca2bac queryset-refactor: Fixed an off-by-one error when filling the select-related
case. Only affects people using select_related() with the "depth" parameter
*and* extra(select=...) simultaneously. Refs #6018. Thanks, Matthias Urlichs.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6755 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 22:07:58 +00:00
Malcolm Tredinnick
dfe05d94b8 queryset-refactor: Merged from trunk up to [6752].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6753 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 20:38:41 +00:00
Malcolm Tredinnick
b43a018032 queryset-refactor: Optimisation pass. The test suite is now within 2% of trunk and it's a fairly pathological case. Introduces a couple of test failures due to some simplification in the code. They'll be fixed later.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6730 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 04:56:09 +00:00
Malcolm Tredinnick
a97abcffc2 queryset-refactor: Merged from trunk up to [6724].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6726 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-28 21:51:17 +00:00
Malcolm Tredinnick
5d85a5147b queryset-refactor: Fixed up a few problems from the previous merge from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6693 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-18 12:07:25 +00:00
Malcolm Tredinnick
3d07f94d68 queryset-refactor: Merged from trunk up to [6689].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6690 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-18 05:48:24 +00:00
Malcolm Tredinnick
44df4e390f queryset-refactor: Merged from trunk up to [6635].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6638 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-03 02:16:27 +00:00
Malcolm Tredinnick
f189280eb3 queryset-refactor: Merged from trunk up to [6623].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6637 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-03 02:15:27 +00:00
Malcolm Tredinnick
f951d97d99 queryset-refactor: Added the ability to apply parameters to the select
fragments in QuerySet.extra(). Refs #2902


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6603 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-24 04:22:23 +00:00
Malcolm Tredinnick
abcb70e524 queryset-refactor: Added a convenience all() method to Querysets. Refs #3739
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6600 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-23 13:49:07 +00:00
Malcolm Tredinnick
3940277792 queryset-refactor: Fixed an order_by() regression. It must override any
existing ordering, not append to it.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6599 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-23 13:34:03 +00:00
Malcolm Tredinnick
5e1a54a3a8 queryset-refactor: Merged from trunk up to [6595].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6597 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-23 12:51:22 +00:00
Malcolm Tredinnick
1e1230c41c queryset-refactor: Changed post_delete signal behaviour back to match trunk's
version (it wasn't in error after all).


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6523 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 23:01:18 +00:00
Malcolm Tredinnick
91b1369709 queryset-refactor: Fixed a broken select_related test from [6521].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6522 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 06:51:37 +00:00
Malcolm Tredinnick
8c10e0d00e queryset-refactor: Fixed a possibility of shooting oneself in the foot and
creating infinite recursion with select_related(). Refs #3045, #3288.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6521 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 05:51:19 +00:00
Malcolm Tredinnick
3429fc0ff2 queryset-refactor: Added a bunch of "new in development version" markers for
recent additions.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6520 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 03:58:20 +00:00
Malcolm Tredinnick
44d51dae68 queryset-refactor: Added a test to show that #5261 is no longer a problem. Refs #5261.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6519 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 03:47:10 +00:00
Malcolm Tredinnick
a3b22d9db0 queryset-refactor: Added ~ support to Q-objects. Based heavily on a patch from
Collin Grady. Refs #4858.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6518 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 03:32:11 +00:00
Malcolm Tredinnick
f74464da52 queryset-refactor: Fixed values(...).select_related(...) bug that was
introduced in [6512]. The lookup tests picked this up.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6517 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 03:31:37 +00:00
Malcolm Tredinnick
70d5e32e13 queryset-refactor: Made the use of values() for ForeignKey fields consistent
and documented this feature. Refs #4358.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6516 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 02:54:30 +00:00
Malcolm Tredinnick
4c4341f012 queryset-refactor: Made sure the ordering columns in a distinct() query only
include the columns we are selecting on. This avoids some PostgreSQL problems
and leads to more efficient queries to boot. Refs #5321.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6515 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 01:20:10 +00:00
Malcolm Tredinnick
e9364c06d6 queryset-refactor: Added a test to show that #3037 is really fixed. Refs #3037.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6514 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 00:48:40 +00:00
Malcolm Tredinnick
e4d1a9aabb queryset-refactor: Updated documentation to describe the new order_by() and
extra(order_by=...) behaviour.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6513 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 00:30:05 +00:00
Malcolm Tredinnick
05ebc901fe queryset-refactor: Fixed a couple of typos that were messing up extra(select=...).
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6512 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 00:29:55 +00:00
Malcolm Tredinnick
201c15dcb6 queryset-refactor: Added an order_by parameter to extra(). Refs #2076.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6511 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 00:29:27 +00:00
Malcolm Tredinnick
a1d160e2ea queryset-refactor: Fixed a large bag of order_by() problems.
This also picked up a small bug in some twisted select_related() handling.

Introduces a new syntax for cross-model ordering: foo__bar__baz, using field
names, instead of a strange combination of table names and field names. This
might turn out to be backwards compatible (although the old syntax leads to
bugs and is not to be recommended).

Still to come: fixes for extra() handling, since the new syntax can't handle
that and doc updates.

Things are starting to get a bit slow here, so we might eventually have to
remove ordering by many-many and other multiple-result fields, since they don't
make a lot of sense in any case. For now, it's legal.

Refs #2076, #2874, #3002 (although the admin bit doesn't work yet).


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6510 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-14 22:38:54 +00:00
Malcolm Tredinnick
6678de130c queryset-refactor: Fixed handling of extra(tables=...). In passing, this solves
a duplicate table / bad SQL problem. Refs #2496.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6504 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-14 03:46:44 +00:00
Malcolm Tredinnick
93b4199912 queryset-refactor: Added a test to show we can now query for empty reverse
relationships. Refs #2400.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6503 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-14 03:46:20 +00:00
Malcolm Tredinnick
91e8062ff5 queryset-refactor: Removed Options.get_order_sql(). It has no role to play any
longer.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6502 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-14 03:46:07 +00:00
Malcolm Tredinnick
d219428b7c queryset-refactor: Removed a whole bunch of unused code. This includes the
final remnants of handle_legacy_orderlist(). Refs #245.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6501 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-14 03:45:53 +00:00