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

4036 Commits

Author SHA1 Message Date
Malcolm Tredinnick
96d643548e queryset-refactor: Added some missed quoting to a table name.
(Noticed in passing in the patch on #6596). Refs #6596.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7428 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-16 02:58:45 +00:00
Malcolm Tredinnick
f2b64c0c4e queryset-refactor: The Oracle changes necessary for [7426]. I can't test these
at the moment, but they should be close to correct.

Refs #6956.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7427 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-16 02:58:26 +00:00
Malcolm Tredinnick
1add6fb366 queryset-refactor: Querysets no longer need to be customised per-backend.
Instead, it's the Query class that is backend-dependent. So make that explicit
in the code (code should refer to sql.Query and they will always get the right
backend-specific class).

This also fixes the main part of #6956, in that the various subclasses of Query
automatically use any custom Query class.

Fixed #6956.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7426 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-16 02:58:00 +00:00
Malcolm Tredinnick
c934beea01 Fixed #6957 -- Removed a stray reference to QuerySet._select_related and added
a way to copy the select_related() settings from an existing queryset.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7425 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-15 04:52:39 +00:00
Malcolm Tredinnick
81b3043827 queryset-refactor: Rewrote [7417] so that it involves less overall indentation.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7419 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-13 04:49:41 +00:00
Malcolm Tredinnick
01b7a16ef0 queryset-refactor: When using select_related() with an explicit foreign key,
use the right join type if the FK is nullable. Fixed #6981.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7418 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-13 04:42:08 +00:00
Malcolm Tredinnick
ed23f00a00 Fixed #6899 -- Fixed a problem with boolean evaluation of empty querysets.
Based on patches from cide@ctmod.net and brodie.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7417 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-13 03:22:38 +00:00
Malcolm Tredinnick
cfb706385b queryset-refactor: Merged from trunk up to [7415].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7416 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-13 03:04:11 +00:00
Malcolm Tredinnick
4efe9675c5 queryset-refactor: Merged from trunk up to [7388].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7396 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-01 00:28:15 +00:00
Malcolm Tredinnick
70913a2c43 queryset-refactor: Moved _merge_sanity_check into a more logical place in the
code.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7395 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-01 00:25:32 +00:00
Malcolm Tredinnick
570c12aeb8 queryset-refactor: People are getting picky about my spelling.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7346 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-21 16:09:41 +00:00
Malcolm Tredinnick
0187f53f09 queryset-refactor: Correctly inherit m2m fields from abstract base classes.
Based on a patch from cide@ctmod.net. Fixed #6844.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7345 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-21 16:06:41 +00:00
Malcolm Tredinnick
9512ebba44 queryset-refactor: Removed an unneeded comparison to NULL for non-nullable
ForeignKey field lookups.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7344 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-21 13:53:37 +00:00
Malcolm Tredinnick
7388d01680 queryset-refactor: Added support for cross-relation values() queries when
extra(select=...) was present (previously, it only worked without extra()).
Also, better error reporting for values() queries with bad field names.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7343 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-21 11:42:00 +00:00
Malcolm Tredinnick
e401ff8ff8 queryset-refactor: Added some sanity checking to __and__() and __or__() because
some people insist on trying to merge a Queryset and a ValuesQuerySet.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7342 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-21 10:59:25 +00:00
Malcolm Tredinnick
334279f8dd queryset-refactor: Merged from trunk up to [7338].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7341 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-20 19:56:44 +00:00
Malcolm Tredinnick
04da22633f queryset-refactor: Fixed up extra(select=...) calls with parameters so that the
parameters are substituted in correctly in all cases. This introduces an extra
argument to extra() for this purpose; no alternative there.

Also fixed values() to work if you don't specify *all* the extra select aliases
in the values() call.

Refs #3141.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7340 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-20 19:16:04 +00:00
Malcolm Tredinnick
e2dfad15f1 queyrset-refactor: Allow default managers to be inherited from an abstract base
class, unless the child class defines its own manager (i.e. child has first
chance to define the default). All managers were already inherited. This just
changes how the default is set in the case when the child defines no manager
and an abstract parent does.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7339 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-20 16:10:51 +00:00
Malcolm Tredinnick
cdeebb33f5 queryset-refactor: Added a missing space in the SQL construction.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7327 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-20 06:17:51 +00:00
Malcolm Tredinnick
22bb040b60 queryset-refactor: Initial pass at fixing the Oracle support. Thanks, Justin Bronn. Fixed #6161
This is untested (by me) and is a slight modification on Justin's original
patch, so feedback and bug reports are welcome.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7321 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-19 15:46:20 +00:00
Malcolm Tredinnick
9ee77a7501 queryset-refactor: Added support for munging of insert columns.
Needed to support cases like GIS fields. Patch from Justin Bronn.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7318 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-19 14:24:23 +00:00
Malcolm Tredinnick
d20996b58d queryset-refactor: Implemented a way to differentiate between filtering on a
single instance and filtering on multiple instances when spanning a
multi-valued relationship.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7317 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-19 11:02:22 +00:00
Adrian Holovaty
c085697858 queryset-refactor: Changed django.VERSION to include 'queryset-refactor'
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7304 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-18 21:10:04 +00:00
Malcolm Tredinnick
150b7ac770 queryset-refactor: Allow exclusions when bumping the aliases on a subquery.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7288 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-18 13:53:22 +00:00
Malcolm Tredinnick
bec21f0e2b queryset-refactor: Fixed problems with values() queries across nullable relations.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7287 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-18 12:46:40 +00:00
Malcolm Tredinnick
67cc3cec90 queryset-refactored: Added a test to show that ordering on multi-valued fields
might not be what is expected.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7286 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-18 10:33:37 +00:00
Malcolm Tredinnick
670be13986 queryset-refactor: Undo [7220] and allow ordering on multi-valued field.
Some people will shoot themselves in the foot with this. That's bad luck.

The reason we need it is because some data semantics cannot be expressed in
Django's ORM and that shouldn't prevent ordering on that data. For example,
filtering suburbs by a geographic region and then ordering on the suburb names.
The names might not be unique outside that region, but unique inside it. Django
cannot know that (you can't tell the model about it), so we trust the caller.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7285 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-18 10:21:50 +00:00
Malcolm Tredinnick
8b52e8e40e queryset-refactor: Removed the facility for select_related(False). It was
useless.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7284 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-18 10:21:12 +00:00
Malcolm Tredinnick
98b5667a06 queryset-refactor: Different database backends return different empty sequences
when fetchmany() is exhausted. This change allows for that. Fixed #6807.

Nice debugging from tpherndon.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7283 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-18 06:15:29 +00:00
Malcolm Tredinnick
6b974720a9 queryset-refactor: Typo fix. Fixed #6806.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7282 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-18 06:14:56 +00:00
Malcolm Tredinnick
6df9e25b61 queryset-refactor: Merged from trunk up to [7280]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7281 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-18 05:45:37 +00:00
Malcolm Tredinnick
133111e40b queyrset-refactor: Some more speed-ups due to datastructure changes.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7255 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-17 13:32:11 +00:00
Malcolm Tredinnick
067d380e98 queryset-refactor: More whack-a-mole optimisation work. Still got a couple of big spots to go, though.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7253 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-16 16:18:39 +00:00
Malcolm Tredinnick
50a1880100 queryset-refactor: Typo fix.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7252 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-16 16:17:57 +00:00
Malcolm Tredinnick
0c84766c58 queryset-refactor: Fixed a typo spotted by msaelices. Fixed #6787.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7250 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-16 01:20:51 +00:00
Malcolm Tredinnick
b102bf28b9 queryset-refactor: Optimised the SQL portion of Model.save().
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7249 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-15 14:16:05 +00:00
Malcolm Tredinnick
ade818fd7d queryset-refactor: Sped up QuerySet.get() by using fast paths through the iterator maze.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7248 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-15 14:15:43 +00:00
Malcolm Tredinnick
93baa3e417 queryset-refactor: Optimised some internal data structures in sql/query.py.
Mostly this involves changing them to a "copy on write" implementation, which
speeds up cloning (and the relevant structures aren't updated very frequently).


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7247 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-15 09:13:22 +00:00
Malcolm Tredinnick
7534ef1f7e queryset-refactor: Optimised len(qs) and iter(qs) a bit.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7246 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-15 09:12:44 +00:00
Malcolm Tredinnick
d08ec81228 queryset-refactor: The EmptyResultSet exception was declared in two places.
Removed one of them.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7245 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-15 02:25:46 +00:00
Malcolm Tredinnick
a81813fb4a queryset-refactor: Fixed the "in" lookup type when using tuples.
Accidentally broken in r7170. Fixed #6772.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-15 01:59:06 +00:00
Malcolm Tredinnick
2f45deb72c queryset-refactor: Some goose left commented out code in [7240]. Nothing to see here. Move along.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7242 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-14 11:49:31 +00:00
Malcolm Tredinnick
59ac04a54d queryset-refactor: Second part of select_related() fix.
Relations on the parent model can now be specified as part of the fields list.
Fixed #6761.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-14 11:46:26 +00:00
Malcolm Tredinnick
cf2da4689a queryset-refactor: Fixed default (no fields) case of select_related() to work with model inheritance. Refs #6761.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7240 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-14 11:45:52 +00:00
Malcolm Tredinnick
d91479a287 queryset-refactor: Changed the return type of an internal function.
Previous polymorphic return type was dumb.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7235 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-13 11:48:25 +00:00
Malcolm Tredinnick
53634d4cdd queryset-refactor: Made sure that update filter queries only return a single
column. Fixed #6760.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7234 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-13 10:46:54 +00:00
Malcolm Tredinnick
9f0fb3dcc9 queryset-refactor: Made none() a method on Querysets, as the documentation
indicates (it was only added to managers in [4394]. Refs #6177.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7232 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-13 00:36:57 +00:00
Malcolm Tredinnick
c8b33b824b queryset-refactor: Added a way to change the prefix of all aliases in a query.
This fixes the last few corner cases for nested queries that had overlapping
aliases. Also tidies up a couple of internal data structures.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7231 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-12 14:52:12 +00:00
Malcolm Tredinnick
428450b7a9 queryset-refactor: Refactored the way values() works so that it works properly
across inherited models.

Completely by accident, this also allows values() queries to include fields
from related models, providing it is crossing a single-valued relation
(one-to-one, many-to-one). Many-to-many values() fields still aren't supported,
since that requires actual thinking. So this refs #5768.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7230 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-12 12:41:58 +00:00
Malcolm Tredinnick
f3ed30f377 queryset-refactor: Infinite loop detection in model ordering was being a little
too aggressive. Fixed that.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7224 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-11 08:23:51 +00:00