1
0
mirror of https://github.com/django/django.git synced 2025-10-10 23:39:11 +00:00

1465 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
97091940b1 queryset-refactor: Merged from trunk up to [6953].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6954 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-19 05:08:37 +00:00
Malcolm Tredinnick
3064a211bf queryset-refactor: Allow specifying of specific relations to follow in
select_related(). Refs #5020.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6899 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-09 06:24:17 +00:00
Malcolm Tredinnick
07ddd56872 queryset-refactor: Merged from trunk up to [6856].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6857 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-03 02:59:56 +00:00
Malcolm Tredinnick
a2418176fd queryset-refactor: Interpret qs.filter(foo=None) to be the same as qs.filter(foo__isnull=True). Refs #2737.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6760 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-30 02:29:25 +00:00
Malcolm Tredinnick
dfe05d94b8 queryset-refactor: Merged from trunk up to [6752].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6753 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 20:38:41 +00:00
Malcolm Tredinnick
a97abcffc2 queryset-refactor: Merged from trunk up to [6724].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6726 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-28 21:51:17 +00:00
Malcolm Tredinnick
5d85a5147b queryset-refactor: Fixed up a few problems from the previous merge from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6693 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-18 12:07:25 +00:00
Malcolm Tredinnick
3d07f94d68 queryset-refactor: Merged from trunk up to [6689].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6690 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-18 05:48:24 +00:00
Malcolm Tredinnick
44df4e390f queryset-refactor: Merged from trunk up to [6635].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6638 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-03 02:16:27 +00:00
Malcolm Tredinnick
f189280eb3 queryset-refactor: Merged from trunk up to [6623].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6637 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-03 02:15:27 +00:00
Malcolm Tredinnick
f951d97d99 queryset-refactor: Added the ability to apply parameters to the select
fragments in QuerySet.extra(). Refs #2902


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6603 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-24 04:22:23 +00:00
Malcolm Tredinnick
abcb70e524 queryset-refactor: Added a convenience all() method to Querysets. Refs #3739
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6600 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-23 13:49:07 +00:00
Malcolm Tredinnick
5e1a54a3a8 queryset-refactor: Merged from trunk up to [6595].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6597 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-23 12:51:22 +00:00
Malcolm Tredinnick
3429fc0ff2 queryset-refactor: Added a bunch of "new in development version" markers for
recent additions.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6520 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 03:58:20 +00:00
Malcolm Tredinnick
a3b22d9db0 queryset-refactor: Added ~ support to Q-objects. Based heavily on a patch from
Collin Grady. Refs #4858.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6518 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 03:32:11 +00:00
Malcolm Tredinnick
70d5e32e13 queryset-refactor: Made the use of values() for ForeignKey fields consistent
and documented this feature. Refs #4358.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6516 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 02:54:30 +00:00
Malcolm Tredinnick
e4d1a9aabb queryset-refactor: Updated documentation to describe the new order_by() and
extra(order_by=...) behaviour.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6513 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-15 00:30:05 +00:00