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
Malcolm Tredinnick
3176bebffd
queryset-refactor: Reorganised Model.save() to differentiate between public and private parameters. Refs #6741 .
...
This means subclasses can override save() without needing to worry about
passing around the internal parameters (an issue for subclassable models, which
would have meant every model, since you don't know when somebody will subclass
your model).
Slightly backwards incompatible, since it moves "raw" back to being part of the
internal API (it's only needed by the serializer and was intended to be
internal use only). If external code really needs this, they can call
Model.save_base() and pass in raw there.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7221 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-11 05:36:10 +00:00
Malcolm Tredinnick
619576002d
queyrset-refactor: Added error reporting if somebody tries to order by a multi-valued field.
...
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7220 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-11 05:21:50 +00:00
Malcolm Tredinnick
62bdb6eae8
queryset-refactor: Merged from trunk up to [7216].
...
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7219 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-11 03:15:07 +00:00
Malcolm Tredinnick
df8e3e6512
queryset-refactor: Fixed an oversight in Model.save() that was preventing updates to parent models beyond the initial save. Fixed #6706 .
...
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7218 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-11 02:48:39 +00:00
Malcolm Tredinnick
f2f933450f
queryset-refactor: Reworked exclude() handling to fix a few merging problems.
...
Fixed #6704 .
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7217 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-11 01:15:15 +00:00
Malcolm Tredinnick
d4d528e9b0
queryset-refactor: Simplified updates of related tables, with added bonus of less bugs.
...
It will be slightly less efficient in rare cases, but who cares? If anybody
needs it to be as efficient as possible they can write the query manually and
this is good enough for the other 98% or so.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7190 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-03 16:36:28 +00:00
Malcolm Tredinnick
22ecacda1b
queryset-refactor: Fixed a small error in [7179].
...
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7180 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-29 15:58:39 +00:00
Malcolm Tredinnick
2f8f588df1
queryset-refactor: Made update() work with inherited models.
...
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7179 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-29 15:53:25 +00:00
Malcolm Tredinnick
fa11a6a128
queryset-refactor: Fixed a problem in the test-suite that was annoying.
...
Only fails on PostgreSQL and only fails on the next test.
Also identified the other area that causes both PostgreSQL backends (only) to
fail. Don't really understand why at the moment, but this is the culprit.
Tricky to reproduce, too, you have to run "queries" and "views" together, in
that order to see it.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7174 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-28 17:53:00 +00:00
Malcolm Tredinnick
2f2908d7b5
queryset-refactor: Merged from trunk up to [7168].
...
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7173 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-28 15:48:19 +00:00
Malcolm Tredinnick
7c54780497
queryset-refactor: Head off any attempts to use unique_together across inherited models.
...
We don't support check constraints and triggers, so trying to do this would be
optimistic at best.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7172 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-28 13:31:11 +00:00
Malcolm Tredinnick
a9008f8928
queryset-refactor: Added caching for reverse-one-to-one lookups.
...
This is the only type of reverse lookup where caching makes sense might make
some kinds of model inheritance interactions more database friendly.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7171 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-28 13:21:33 +00:00
Malcolm Tredinnick
33a0862215
queryset-refactor: Fixed exclude() filtering for the various N-to-many relations.
...
This means we can now do nested SQL queries (since we need nested queries to
get the right answer). It requires poking directly at the Query class. Might
add support for this through QuerySets later.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7170 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-28 12:57:10 +00:00
Malcolm Tredinnick
0588dee34c
queryset-refactor: Fixed a few really silly errors in the Q class and negation
...
handling in the tree class. Discovered whilst starting to fix exclude().
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7169 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-28 02:49:31 +00:00