1
0
mirror of https://github.com/django/django.git synced 2025-10-11 07:49:35 +00:00

138 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
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
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
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
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
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
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
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
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
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
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
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
Malcolm Tredinnick
e9f1f50461 queryset-refactor: Re-added a docs change that was accidentally lost in the merge in [6466].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6488 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-14 02:13:13 +00:00
Malcolm Tredinnick
7ebf3068c1 queryset-refactor: Merged changed from trunk up to [6463].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6466 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-08 16:10:39 +00:00
Adrian Holovaty
28a4aa6f49 queryset-refactor: Merged to [6340]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6341 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-15 22:00:35 +00:00
Adrian Holovaty
ca33d307de queryset-refactor: Merged to [6300]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6340 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-15 21:57:25 +00:00
Adrian Holovaty
bf6a46d8ad queryset-refactor: Merged to [6190]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6334 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-15 21:34:09 +00:00
Adrian Holovaty
a882e6076b queryset-refactor: Merged to [6130]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6330 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-15 21:15:56 +00:00
Malcolm Tredinnick
4751fd9ba7 Added a note about not using 'pk' as a field name for a non-primary-key field.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6114 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-13 02:48:06 +00:00
Adrian Holovaty
33ab65dd1e Made negligible capitalization fix to docs/db-api.txt
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6027 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-31 04:30:20 +00:00
Adrian Holovaty
de2881f9f2 Removed incorrect link that slipped in docs/db-api.txt in [6010]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6011 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-25 18:59:59 +00:00
Adrian Holovaty
b189e266ef Fixed #5068 -- Fixed error in docs/db-api.txt. Thanks, Collin Grady and SmileyChris
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6010 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-25 18:58:36 +00:00
Gary Wilson Jr
212ee65be7 Fixed #2101 -- Renamed maxlength argument to max_length for oldforms FormFields and db model Fields. This is fully backwards compatible at the moment since the legacy maxlength argument is still supported. Using maxlength will, however, issue a PendingDeprecationWarning when used.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-05 05:14:46 +00:00
Gary Wilson Jr
973f44aa4c Changed some more links to be relative in the documentation. I had a couple unsaved files that didn't get in with [5798].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5802 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-05 04:42:26 +00:00
Gary Wilson Jr
ac027df253 Changed several documentation links to be relative.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5798 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-04 03:39:24 +00:00
Gary Wilson Jr
9a54c8f2d4 Fixed #5037 -- Fixed use of wrong field type in a db-api docs example, thanks ubernostrum.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5783 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-01 05:52:18 +00:00
Adrian Holovaty
6b7c33286a Added 'New in Django development version' to docs/db-api.txt change from [5746]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5757 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-25 03:15:05 +00:00
Gary Wilson Jr
cae92ae615 Fixed #4373 -- Modified the get_object_or_404/get_list_or_404 shortcuts to also accept QuerySets. Thanks SuperJared.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5746 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-22 03:41:11 +00:00
Gary Wilson Jr
62f207caef Fixed #4851 -- Fixed description of an example query in db-api docs.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5720 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-16 22:29:09 +00:00
Adrian Holovaty
2a500b3551 Edited docs/db-api.txt changes from [5700]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5709 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-15 19:34:21 +00:00
Russell Keith-Magee
eff675b91e Clarified the documentation on the steps that happen during a save, and how raw save affects those steps.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5700 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-15 04:41:59 +00:00
Adrian Holovaty
0f869d1124 Edited docs/db-api.txt changes from [5658]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5698 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-14 16:58:54 +00:00
Russell Keith-Magee
2d6d20def7 Fixed #4459 -- Added 'raw' argument to save method, to override any pre-save processing, and modified serializers to use a raw-save. This enables serialization of DateFields with auto_now/auto_now_add. Also modified serializers to invoke save() directly on the model baseclass, to avoid any (potentially order-dependent, data modifying) behavior in a custom save() method.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5658 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-12 07:45:35 +00:00
Malcolm Tredinnick
953badbea5 Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.

Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
Adrian Holovaty
510e545776 Fixed #4690 -- Fixed a bunch of ReST errors in docs. Thanks, Paul B.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5571 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-01 01:00:23 +00:00
Adrian Holovaty
64f20046f1 Edited docs/db-api.txt changes from [5555]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5566 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-30 21:25:10 +00:00
Jacob Kaplan-Moss
a9807db552 Fixed #4712: added mention of Oracle in docs from [5555]. Thanks, Tom.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5556 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-27 19:16:05 +00:00