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

4043 Commits

Author SHA1 Message Date
Malcolm Tredinnick
a4343209db queryset-refactor: s/udpate/update. :-(
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7049 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-29 15:49:43 +00:00
Malcolm Tredinnick
f99247cc1b queryset-refactor: Ported almost all of the raw SQL statements in the Model
class over to use queryset operations. This is the first part of a long process
of removing raw SQL from all over the place. The tests pass, but it's quite
possible other stuff won't work yet.

In the process, added tests for order_with_respect_to so that I didn't screw it
up.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7048 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-29 15:44:21 +00:00
Malcolm Tredinnick
a214c6b86a queryset-refactor: Added some error checking for a potential crasher if model ordering is set up in a cycle somehow. The error reporting here isn't perfect (it doesn't give any hints about what the infinite loop might be), but it's better than nothing.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7046 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-28 16:08:34 +00:00
Malcolm Tredinnick
3c490660c5 queryset-refactor: Fixed an idiotic, last-minute typo in [7043].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7045 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-28 16:08:06 +00:00
Malcolm Tredinnick
de94d0cb93 queryset-refactor: Added an update method to QuerySets, since it's needed for
moving SQL out of the core code. Only direct fields and foreign keys can be
updated in this fashion, since multi-table updates are very non-portable.

This also cleans up the API for the UpdateQuery class a bit. Still need to
change DeleteQuery to work similarly, I suspect.

Refs #4260.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7043 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-28 14:27:53 +00:00
Malcolm Tredinnick
911e65ada7 queryset-refactor: Added a way to clear all default ordering from a queryset,
by calling order_by() with no parameters.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7042 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-28 14:27:16 +00:00
Malcolm Tredinnick
e016a4f987 queryset-refactor: Added the ability to use a subclass of WhereNode in queries. Also allow extension of the permitted lookup terms. Both of these are drive by geo-django requirements, but should be generally useful. Thanks, Justin Bronn.
Fixed #6261.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7031 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-27 11:17:33 +00:00
Malcolm Tredinnick
dd2251a653 queryset-refactor: Converted the queryset iterator to be a real iterator and
only populate the result cache on demand. We actually populate the result cache
100 elements at a time, rather than one at a time for efficiency, but this is a
real win when the resultset contains 10,000 objects for example.

This also provides an efficient boolean (__nonzero__) test that doesn't use up
a lot of memory if you don't read all the results.

Refs #2430, #5987.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7030 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-26 13:23:54 +00:00
Malcolm Tredinnick
98abf27535 queryset-refactor: Merged from trunk up to [7025].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7029 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-26 13:23:25 +00:00
Malcolm Tredinnick
83cb2218bc queryset-refactor: Merged from trunk up to [7002].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7004 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-09 06:08:40 +00:00
Malcolm Tredinnick
b824d803ce queryset-refactor: Added a couple of tests to demonstrate table handling in order_by() situations. One is known to fail (and commented out for now).
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6968 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-22 11:16:21 +00:00
Malcolm Tredinnick
e247b36447 queryset-refactor: Work around the fact that "where id is NULL" can return different results in different circumstances in MySQL(!!).
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-22 11:16:04 +00:00
Malcolm Tredinnick
f47cfe12ae queryset-refactor: Tweaked one test slightly to work around a PostgreSQL oddity.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6962 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-19 13:43:16 +00:00
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