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

4061 Commits

Author SHA1 Message Date
Malcolm Tredinnick
caa150e45e queryset-refactor: Fixed some bugs in the multi-valued filtering behaviour
introduced in [7317]. It was failing in a couple of different ways on some
complex Q() combinations.

Fixed #7047


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7462 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-25 17:08:28 +00:00
Malcolm Tredinnick
05e4d51f0d queryset-refactor: Simplify the way filters are passed to the Query class.
This removes a lot of the complexity for handling exclude() calls and results
in more efficient code. I feel a bit stupid for not having spotted this earlier.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7461 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-25 15:02:25 +00:00
Malcolm Tredinnick
fcc3648b60 queryset-refactor: Fixed a typo that was shown up by some simplification refactoring.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7460 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-25 15:01:59 +00:00
Malcolm Tredinnick
bb92611979 queryset-refactor: Fixed a bug in the internal Query.join_map datastructure.
Could result in some incorrect results(?) when using the same table multiple
times in a query.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7459 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-25 15:01:40 +00:00
Malcolm Tredinnick
6657d476d0 queryset-refactor: An attempt to fix an ambiguous column error that can arise
in Oracle queries. Adds an options to add output column aliases.

The testing I can do shows that the query is being constructed correctly. I
haven't run the test against an Oracle install, though.

Refs #7057 (ticket can be closed if the Oracle tests pass).


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7457 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-25 06:54:35 +00:00
Malcolm Tredinnick
8a4e1de8b0 queryset-refactor: Changed the way order_by() and distinct() interact.
When using "select distinct" all ordering columns must be part of the output
(select) columns. We were previously just throwing away ordering columns that
weren't included, but there are some cases where they are needed and it's
difficult to add them in manually. So now the default behaviour is to append
any missing columns.

This can affect the output of distinct() if complicated order_by() constructs
are used, so the documentation has been updated with an explanation of what's
going on there.

Fixed #7070.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7455 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-24 16:07:07 +00:00
Malcolm Tredinnick
dd0c5855e9 queryset-refactor: A few bits of code cleanup.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7454 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-24 12:15:46 +00:00
Malcolm Tredinnick
28b1c9c1c9 queryset-refactor: Added a note about using already present tables in
extra(tables=...). This is already a problem in trunk and it's pretty much
impossible to work around in a non-complex way, so it's user beware (it's
usually easy enough to avoid the problems).


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7453 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-24 11:41:29 +00:00
Malcolm Tredinnick
675815d6a1 queryset-refactor: Clarified what the default reverse names are for
ManyToManyFields and ForeignKeys on abstract base classes.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7452 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-24 11:21:49 +00:00
Malcolm Tredinnick
9d6f0f9e10 queryset-refactor: Renamed the Queryset method valueslist() to values_list.
Suggested by Michael Trier. It's more consistent with order_by, select_related,
etc. This is backwards incompatible for people previously using this method on
the branch (the method doesn't exist on trunk, so it's very minor).


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7451 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-24 11:11:30 +00:00
Malcolm Tredinnick
27b0a4c4e7 queryset-refactor: Removed a warning about "experimental API", since there's
not really any obviously better way to do this. Let it stand.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7448 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-23 12:34:13 +00:00
Malcolm Tredinnick
19d6bc7acd queryset-refactor: Fixed a crash when using extra(tables=...). Fixed #7045.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7447 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-23 10:43:42 +00:00
Malcolm Tredinnick
42dc3b9ba2 queryset-refactor: Fixed the interaction between extra(select=...) and
valuelist(). Fixed #7053.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7446 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-23 09:53:22 +00:00
Malcolm Tredinnick
42260ef737 queryset-refactor: Removed an unwanted side-effect from the Query.as_sql() method.
Fixed #7056


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7445 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-23 09:26:14 +00:00
Malcolm Tredinnick
382d31a981 queryset-refactor: Fixed some errors in Oracle regex handling that were
introduced in [7087]. Patch from Ian Kelly. Fixed #7065.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7444 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-23 07:30:59 +00:00
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