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

4046 Commits

Author SHA1 Message Date
Malcolm Tredinnick
5a9a208b7a queryset-refactor: The change in [7438] didn't fix #7036 properly. This is a
more comprehensive diagnosis and fix from Ian Kelly. Fixed #7036.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7443 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-23 07:30:30 +00:00
Malcolm Tredinnick
0a66eabc8a queryset-refactor: Made on of the tests use more portable SQL to help Oracle.
Patch from Ian Kelly. Fixed #7058.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7440 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-22 18:10:12 +00:00
Malcolm Tredinnick
88488e5aa5 queryset-refactor: Don't use the "AS" keyword in the FROM-clause. Fixed #7055.
Patch from Ian Kelly.

This keyword is optional in SQL, but not permitted by Oracle. If we ever need
to support a backend that requires this keyword at some later date, we can make
it a connection.feature option, but that's overkill for now.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7439 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-22 18:09:55 +00:00
Malcolm Tredinnick
c43a3d78b1 queryset-refactor: Fixed db column to model field mapping for Oracle backend.
Thanks, Justin Bronn. Fixed #7036.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7438 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-20 08:47:41 +00:00
Malcolm Tredinnick
d4956cb427 queryset-refactor: Added faster paths for updates and inserts that are done
from other core code. This saves a round-trip from field object to field name
and back to field object when we already have the right information to hand.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7437 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-20 08:47:21 +00:00
Malcolm Tredinnick
fcfa8b204a queryset-refactor: Removed a stray, unused import that crept into [7432].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7433 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-16 08:18:03 +00:00
Malcolm Tredinnick
2b426635aa queryset-refactor: Added a way to specify the related_name attribute on
abstract base classes.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7432 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-16 08:09:46 +00:00
Malcolm Tredinnick
b114fecfe4 queryset-refactor: Fixed a few inadvertent sharing problems for related fields
in abstract base classes. This means, for example, that many-to-many fields can
be used in abstract base classes.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7431 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-16 08:09:18 +00:00
Malcolm Tredinnick
a14135e14f queryset-refactor: Merged from trunk up to [7424].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7430 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-16 04:59:55 +00:00
Malcolm Tredinnick
36bbebc739 queryset-refactor: Detect infinite ordering loops when relations refer to 'self'.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7429 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-16 04:32:56 +00:00
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