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

4030 Commits

Author SHA1 Message Date
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
Malcolm Tredinnick
c8afb75d53 queryset-refactor: Typo fix. Fixed #6670. Thanks, alex.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7166 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-27 02:47:32 +00:00
Malcolm Tredinnick
64315b9eec queryset-refactor: Removed some more dead code.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7165 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-27 02:47:14 +00:00
Malcolm Tredinnick
231e735c07 queryset-refactor: Moved the Query subclasses into their own file.
Trying to keep file lengths to something manageable.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7164 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-27 02:15:41 +00:00
Malcolm Tredinnick
014373b459 queryset-refactor: Fixed #6664. Calling list() no longer swallows field errors.
This is slightly backwards incompatible with previous behaviour if you were
doing Tricky Stuff(tm) -- the exception type has changed if you try to create a
bad queryset.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7163 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-27 00:44:44 +00:00
Malcolm Tredinnick
fc4c0f7b39 queryset-refactor: Removed some unused code left over from an earlier attempt.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7162 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-27 00:43:40 +00:00
Malcolm Tredinnick
3691613093 queryset-refactor: Added a test to show that #6180 is fixed. Refs #6180.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7154 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-25 06:17:16 +00:00
Malcolm Tredinnick
bdeba9ab94 queryset-refactor: Merged from trunk up to [7151].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7152 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-23 09:26:11 +00:00
Malcolm Tredinnick
cbd6da3540 queryset-refactor: Added valuelist() method to querysets. Refs #2482.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7149 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-23 03:36:38 +00:00
Malcolm Tredinnick
6ad9c684aa queryset-refactor: Implemented the reverse() method on querysets.
Refs #5012.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7148 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-23 01:35:34 +00:00
Malcolm Tredinnick
7355fa6b72 queryset-refactor: Implemented slicing to end of querysets.
Refs #2150, #5012.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7147 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-23 01:34:49 +00:00
Malcolm Tredinnick
e2f524ca09 queryset-refactor: Fixed the case of calling update() on a model manager.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7146 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-23 00:23:57 +00:00
Malcolm Tredinnick
e2b3c50cf0 queryset-refactor: Removed some tuple unpacking in a function signature.
This isn't going to be permitted in Python 3, so might as well not use it here.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7144 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-22 05:46:46 +00:00
Malcolm Tredinnick
83e00a2371 queryset-refactor: Whilst writing a test to bullet-proof [7141], a bug showed up.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7143 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-22 04:58:53 +00:00
Malcolm Tredinnick
b7be3d63e3 queryset-refactor: Added the ability to manually specify a child-parent link.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7142 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-22 04:58:28 +00:00
Malcolm Tredinnick
0c20e88e65 queryset-refactor: Fixed up and documented Meta-class inheritance.
Should be mostly logical (for versions of "logical" that may require you to be
a Vulcan, admittedly, but that's not entirely my fault).


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7141 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-22 01:05:05 +00:00
Malcolm Tredinnick
ca123b0760 queryset-refactor: Fixed a couple of FIXME items.
These are mostly code cleanups, although now we also install the right type of
class for our exception sublasses on models in Python 2.5.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7137 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-20 02:00:20 +00:00
Malcolm Tredinnick
3dd28bd566 queryset-refactor: Merged from turnk up to [7135] because I need some stuff.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7136 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-20 01:59:59 +00:00
Malcolm Tredinnick
da6570bf08 queryset-refactor: Model inheritance support.
This adds both types of model inheritance: abstract base classes (ABCs) and
multi-table inheritance. See the documentation and tests / examples for details.

Still a few known bugs here, so don't file tickets (I know about them). Not
quite ready for prime-time usage, but it mostly works as expected.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7126 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-17 18:47:57 +00:00
Malcolm Tredinnick
2d0588548e queryset-refactor: Merged from trunk up to [7122].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7124 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-16 06:57:52 +00:00
Malcolm Tredinnick
770d587314 queryset-refactor: Two files were missed during the latest merge from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7123 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-16 06:56:10 +00:00
Malcolm Tredinnick
748e1bdf42 queryset-refactor: Merged from trunk up to [7098] (because I need the last
commit on this branch).


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7099 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-08 12:23:34 +00:00
Malcolm Tredinnick
accc20d799 queryset-refactor: Fixed up OneToOneFields (mostly).
They now share as much code as possible with ForeignKeys, but behave more or
less as they did before (the backwards incompatible change is that they are no
longer automatically primary keys -- so more than one per model is permitted).

The documentation still uses an example that is better suited to model
inheritance, but that will change in due course. Also, the admin interface
still shows them as read-only fields, which is probably wrong now, but that can
change on newforms-admin after this branch is merged into trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7096 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-08 09:49:17 +00:00
Malcolm Tredinnick
55cd025670 queryset-refactor: Fixed a place where admin was poking about under the covers and I had moved the internal feature it was relying on.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7095 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-08 04:22:00 +00:00
Malcolm Tredinnick
755bb2a3f2 queryset-refactor: Added (back) in support for using strings in slices.
Apparently there exists code that like to do this, including the admin
interface.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7094 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-08 04:21:39 +00:00
Malcolm Tredinnick
0a07dac880 queryset-refactor: Removed handle_legacy_orderlist() call from admin. Refs #245.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7093 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-08 04:21:21 +00:00
Malcolm Tredinnick
c23436be59 queryset-refactor: Removed another FIXME.
This time, simplifying the delete() method.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7092 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-06 04:10:58 +00:00
Malcolm Tredinnick
04a55d663f queryset-refactor: Fixed a typo that's been hiding out for a few months.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7088 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-04 12:05:01 +00:00
Malcolm Tredinnick
5df5551d07 queryset-refactor: Moved some backend-specific features into the database
backend code.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7087 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-04 12:02:36 +00:00
Malcolm Tredinnick
0a9b751958 queryset-refactor: Merged changes from trunk up to [7085].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7086 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-04 05:45:17 +00:00
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