Commit Graph

772 Commits

Author SHA1 Message Date
Jacob Kaplan-Moss c00e8d2064 Added a `QuerySet.ordered` property to check if a queryset is already ordered. Refs #10163.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10623 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-22 22:16:19 +00:00
Matt Boersma b09f554175 Fixed #10716 so Oracle tests run again. Thanks very much, kmtracey.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10608 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-21 18:09:03 +00:00
Russell Keith-Magee f0d75dbe3e Fixed #10833 -- Corrected load_backend so that it actually loads the requested backend, rather than always loading settings.DATABASE_BACKEND. Thanks to Alex Gaynor for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10560 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-16 12:44:32 +00:00
Russell Keith-Magee fd3ee7d786 Fixed #9804 -- Corrected the introspection of sequence names. This was causing problems when flushing tables that had many-to-many relations through an inherited table. Thanks to jdimov for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10552 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-13 07:07:51 +00:00
Russell Keith-Magee 0fec0a5d70 Fixed #10237 -- Corrected the handling of self-referential m2m fields when using multi-table inheritance. Thanks to Justin Lilly for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10550 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-13 02:59:40 +00:00
Malcolm Tredinnick 91fe5d50dd Fixed #10716 -- Fixed a couple of typos in Oracle testing setup.
Thanks, canarix.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10547 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-12 05:55:29 +00:00
Malcolm Tredinnick e9814029f5 Fixed #10692 -- Fixed DecimalField lookups for extreme values.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10545 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-12 05:32:23 +00:00
Malcolm Tredinnick 77066516a0 Fixed #10438 -- Fixed MySQL backend behaviour for UPDATE behaviour.
We need to know the number of rows that are matched by an UPDATE query,
not just the number of rows that are changed. In the relatively unlikely
event that somebody was using Django's cursor proxy and relying on the
previous behaviour, well, that isn't the case any longer. We need to
this version.

Thanks to Daniel Tang for pointing out the solution here.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10532 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-12 02:15:14 +00:00
Malcolm Tredinnick a584a6b40f Fixed #10071 -- Changed some internal database data representations.
We now pass numbers used in data queries as actualy numbers (integers) to the
database backends, rather than string forms. This is easier for some of the
less flexible backeds.

Based on a patch from Leo Soto and Ramiro Morales.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10530 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-12 02:00:58 +00:00
Russell Keith-Magee 4a4d3e2133 Fixed #10796 -- Corrected a pickling problem introduced by [10522]. Thanks to carljm for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10526 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-11 15:25:15 +00:00
Russell Keith-Magee e12e0e18a4 Fixed #10197 -- Corrected pickling of querysets when a subset of fields was selected.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10522 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-11 13:20:51 +00:00
Russell Keith-Magee 0fff47c90f Fixed #10766 -- Raise an error when annotate() references another aggreagte(). Thanks to aseering@mit.edu for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10521 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-11 12:09:34 +00:00
Malcolm Tredinnick d18f75af44 Fixed #10357 -- Fixed the "dbshell" command for Windows users.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10517 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-11 11:41:35 +00:00
Malcolm Tredinnick 8fecf36b68 Fixed #10450 -- Fixed an initialisation problem in the savepoint code.
Patch from Jeremy Dunck.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10511 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-11 07:51:07 +00:00
Ian Kelly e07a3a278e Fixed BooleanFields being coerced null=True in Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10505 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-11 00:06:53 +00:00
Jacob Kaplan-Moss a34b718192 Fixed #9640, #10549: BooleanFields with choices, a default, and null=False now correctly doesn't generate a blank option.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10500 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-10 19:54:31 +00:00
Jacob Kaplan-Moss c0ad626dca Fixed #10647: intermediary tables between two umanaged models are no longer created.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10455 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-09 15:03:31 +00:00
Russell Keith-Magee 98ef7e85bd Fixed #10666 -- Corrected the handling of inherited fields with aggregate() and annotate(). Thanks to julienb for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10446 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-08 13:19:48 +00:00
Karen Tracey 48e01d2b3d Fixed up the introspection code and tests added for #9779 to run under Python 2.3, which has neither set nor rsplit.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10392 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-04 19:03:55 +00:00
Malcolm Tredinnick 2b1934ff3c Fixed a problem when computing deferred fields on multiple related models.
Fixed #10710, as this fixes the second bug reported there.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10384 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-04 05:35:01 +00:00
Malcolm Tredinnick 0a89a57ffc Fixed deferred fields and select_related() interaction.
Loading related models when some fields were deferred was resulting in
incorrect offsets being used into the results row, causing the wrong data to be
assigned to attributes.

Refs #10710. This fixes the first of two bugs reported there.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10383 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-04 05:34:23 +00:00
Malcolm Tredinnick dded5f52cc Fixed #10695 -- Fixed implementation of deferred attribute retrieval.
The original implementation had a few silly bugs in it that meant that data was
not being used only on the instance of the class that it was appropriate for
(one of the traps when using class-level things). No more!

Thanks to Justin Bronn and Alex Gaynor for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10382 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-04 03:21:31 +00:00
Jacob Kaplan-Moss ffffdedfd1 Fixed #9991: correctly introspect PostgreSQL 'real' types.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10379 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-03 20:52:54 +00:00
Jacob Kaplan-Moss ef9bedf815 Fixed #9779: added support for relation detection to inspectdb under SQLite. Thanks, gabbott and ramiro.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10364 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-02 05:02:39 +00:00
Jacob Kaplan-Moss bb2aa792af Fixed #10063: stop passing the -W flag to psql since it isn't needed and interferes with .pgpass. Thanks, Walter.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10360 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-02 02:03:46 +00:00
Jacob Kaplan-Moss 25130b9675 Fixed #10670: fixed reusing QuerySets previously used in a filter expression. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10357 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-02 01:49:12 +00:00
Justin Bronn 03de1fe5f4 Fixed #9871 -- Geometry objects are now returned in dictionaries and tuples returned by `values()` and `values_list()`, respectively; updated `GeoQuery` methods to be compatible with `defer()` and `only`; removed defunct `GeomSQL` class; and removed redundant logic from `Query.get_default_columns`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10326 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-01 16:01:50 +00:00
Joseph Kocherhans fea6c73538 Fixed #10149. FileFields in a form now validate max_length. Based on a patch by Massimo Scamarcia.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10227 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 22:52:16 +00:00
Jacob Kaplan-Moss 6ce25d3be9 Fixed #10413: RelatedManager.add no longer fails silenty when trying to add an object of the wrong type. Thanks, dgouldin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10226 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 22:41:49 +00:00
Jacob Kaplan-Moss 02e56530c5 Fixed #10157: correctly set the related objects pk when assigning a reverse OneToOne. Thanks, dgouldin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10224 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 22:38:19 +00:00
Justin Bronn d02ee6bd7b Fixed redundant definition of `connection_created` signal due to DVCS mistake. My bad.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10187 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 03:11:12 +00:00
Justin Bronn da3b38cdda Fixed #6064 -- Added the `connection_created` signal for when a database connection is created.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10182 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-29 23:15:58 +00:00
Ian Kelly faf1609851 Fixed an issue with unicode being mangled in Oracle when the database character set is non-unicode.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10175 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-27 19:48:02 +00:00
Malcolm Tredinnick 6671b8b1cd Fixed a breakage with ManyToManyFields in admin caused by r10139.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10170 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-25 04:41:40 +00:00
Malcolm Tredinnick fd46f673bd Fixed #9926 -- Fixes for some select_related() situations.
Using select_related(...) across a nullable relation to a multi-table
model inheritance situation no longer excludes results. Thanks to AdamG
for a test demonstrating part of the problem.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10136 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-24 03:59:38 +00:00
Malcolm Tredinnick 5ac154e065 Fixed deferred loading of fields with default values.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10113 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-22 01:45:22 +00:00
Justin Bronn 6e3b129f15 Fixed #9628 -- Use `pysqlite2` for database backend, if installed.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10105 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-20 03:57:21 +00:00
Malcolm Tredinnick fa89fdcd6b Fixed #2698 -- Fixed deleting in the presence of custom managers.
A custom manager on a related object that filtered away objects would prevent
those objects being deleted via the relation. This is now fixed.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10104 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-20 03:57:12 +00:00
Malcolm Tredinnick 255cb391d1 Fixed #10547 -- Worked around some odd behaviour in Python 2.3 and 2.4.
Calling the super() version of __reduce__ in Model.__reduce__ led to infinite
loops in Python prior to 2.5. We don't do that any longer.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10099 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-20 01:37:11 +00:00
Malcolm Tredinnick 014b961509 Typo fix for an error path in r100090.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-19 09:43:45 +00:00
Malcolm Tredinnick 29050ef999 Fixed #5420 -- Added support for delayed loading of model fields.
In extreme cases, some fields are expensive to load from the database
(e.g. GIS fields requiring conversion, or large text fields). This
commit adds defer() and only() methods to querysets that allow the
caller to specify which fields should not be loaded unless they are
accessed.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10090 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-19 09:06:04 +00:00
Jacob Kaplan-Moss c485e236bd Fixed #8193: all dynamic imports in Django are now done correctly. I know this because Brett Cannon borrowed the time machine and brought Python 2.7's '`importlib` back for inclusion in Django. Thanks for the patch-from-the-future, Brett!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10088 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-18 16:55:59 +00:00
Malcolm Tredinnick 61a2708c41 Fixed #10356 -- Added pure-Python inheritance for models (a.k.a proxy models).
Large portions of this are needed for #5420, so I implemented it fully.
Thanks to Ryan Kelly for an initial patch to get this started.

Refs #5420.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10083 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-18 09:47:08 +00:00
Malcolm Tredinnick 536ccd1134 More fixing of PostgreSQL < 8.2 problems with the psycopg2 backend.
Affects the postgresql_psycopg2 backend only. We now don't use the
"RETURNING" syntax in SQL INSERT statements unless it's required by the
autocommit behaviour. This fixes an edge-case that could cause crashes
with earlier PostgreSQL versions, but the broader problem remains to be
fixed (which is #10509).

Fixed #10467. Refs #10509.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10065 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-16 00:34:58 +00:00
Malcolm Tredinnick 7d9b29a56d Use plain model.Manager, or suitable proxy, for model saving.
We can't use the default manager in Model.save_base(), since we need to
retrieve existing objects which might be filtered out by that manager. We now
always use a plain Manager instance at that point (or something that can
replace it, such as a GeoManager), making all existing rows in the
database visible to the saving code.

The logic for detecting a "suitable replacement" plain base is the same as for
related fields: if the use_for_related_fields is set on the manager subclass,
we can use it. The general requirement here is that we want a base class that
returns the appropriate QuerySet subclass, but does not restrict the rows
returned.

Fixed #8990, #9527.

Refs #2698 (which is not fixed by this change, but it's the first part of a
larger change to fix that bug.)

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10056 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-15 03:41:33 +00:00
Russell Keith-Magee 84ce18fc9b Fixed #10425 -- Corrected the interaction of .count() with .annotate() when .values() is also involved. Thanks to kmassey for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10053 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-14 04:32:52 +00:00
Ian Kelly 83c1572cc4 Fixed #10488: fixed DB cache backend test failures in Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10051 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-13 21:04:48 +00:00
Ian Kelly 0ae95f80b4 Fixed #10238: coerce TextField values to unicode in the oracle backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10049 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-13 19:57:00 +00:00
Ian Kelly f725658299 Fixed a case where column aliases weren't being quoted properly.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10048 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-13 17:20:52 +00:00
Ian Kelly 6309b40bc2 Prevented InsertQuery from appending a 'RETURNING' clause when it's not actually interested in the result. This was causing some problems for Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10047 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-13 16:57:26 +00:00