Commit Graph

406 Commits

Author SHA1 Message Date
Russell Keith-Magee e829e9ff8f Fixed #7044 -- Corrected a minor typo in a docstring in the model loader. Thanks, msaelices.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7679 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-17 13:58:19 +00:00
Adrian Holovaty 06315375ce Fixed #7420 -- Abstracted some more database options into DatabaseFeatures -- supports_usecs, time_field_needs_date, interprets_empty_strings_as_nulls and date_field_supports_time_value -- and changed various hard-coded 'if DATABASE_BACKEND == oracle' statements to use the new options. Thanks to ramiro for the patch
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7643 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-16 03:15:04 +00:00
Russell Keith-Magee 57311b5998 Fixed #7256 -- Corrected queryset code to return the correct set of columns when the query has an empty values() clause as well as extra selects from an extra() clause. Thanks to Nicolas Lara for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7636 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-15 06:24:41 +00:00
Gary Wilson Jr 0b8fafc7f1 Fixed #7387 - Fixed circular import problem when importing `contrib.contenttypes.generic` module.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7635 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-15 04:49:29 +00:00
Adrian Holovaty ac5b9f5857 Fixed #7427 -- Fixed docstring that was rendered incorrect due to qs-rf. Thanks, ramiro
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7624 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-12 04:23:14 +00:00
Adrian Holovaty 5309e18cbf Fixed #7026 -- Fixed misleading/incorrect exception text when adding to a many-to-many set on an object that doesn't yet have a primary-key value. Thanks for the report, ryan@peaceworks.ca
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7622 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-12 04:13:16 +00:00
Adrian Holovaty a08b2dd328 Negligible comment typo fixes
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7620 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-12 03:37:13 +00:00
Jacob Kaplan-Moss b5f92938ab Fixed #7298: prevent update() on sliced QuerySet since UPDATE doesn't reliably support LIMIT/OFFSET. Thanks, George Vilches.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7601 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-09 16:17:54 +00:00
Russell Keith-Magee 12716794db Fixed #7350, #7202 -- Fixed serialization for multi-model inheritance, which had multiple problems:
* Serializers were including all superclass fields in their output. Now only local fields are included.
 * Implicit OneToOne primary keys were not correctly added to the metamodel, so they were always marked to be serialized, even though they were primary
 * Model saving was too aggressive about creating new parent class instances during deserialization. Raw save on a model now skips saving of the parent class.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7600 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-09 14:03:35 +00:00
Jacob Kaplan-Moss 31d9dc07aa Fixed #7369: fixed a corner-case involving select_related() following non-null FKs after null ones. Thanks, George Vilches
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7597 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-08 18:13:46 +00:00
Jacob Kaplan-Moss 50de13343b Fixed #7342: Ignore any Meta options starting with '_', thus making it OK for Meta to be a newstyle class. Thanks, Gulopine.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7585 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-07 20:01:18 +00:00
Jacob Kaplan-Moss 1452d46240 Fixed #6886: Tightened up ForeignKey and OneToOne field assignment. Specifically:
* Raise a ValueError if you try to assign the wrong type of object.
  * Raise a ValueError if you try to assign None to a field not specified with null=True.
  * Cache the set value at set time instead of just at lookup time.

This is a slightly backwards-incompatible change; see BackwardsIncompatibleChanges for more details.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7574 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-05 00:39:32 +00:00
Russell Keith-Magee 5837a45bd9 Fixed #7173 -- Corrected the caching of objects in reverse OneToOne relationships. Thanks, Travis Terry.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7561 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-29 12:17:03 +00:00
Russell Keith-Magee 8a0b8d93b2 Fixed #7286 -- Added functools wrapping to the transaction decorators. Thanks, SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7558 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-29 11:50:50 +00:00
Russell Keith-Magee b2b7a0c1cc Fixed #7306 -- Added missing import. Thanks, SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7556 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-29 11:41:46 +00:00
Gary Wilson Jr d78e61e8bb Fixed #7212 -- Added `alters_data` attribute to `Model.save_base` method, thanks Gulopine.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7526 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-13 14:56:47 +00:00
Ian Kelly 3c4d353016 Cleaned up some comments in the Oracle backend. Fixes #7139. Thanks, adamv.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7514 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-05 16:04:50 +00:00
Ian Kelly db6bab5cb3 Fixed an Oracle error on double negations in where conditions. Fixed #7111
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7509 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-29 20:55:10 +00:00
Malcolm Tredinnick 2061b3f3ca Undo [7474]. I didn't think it through nearly carefully enough.
This means that all model construction now goes through the __init__() method
again.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7504 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-29 01:19:42 +00:00
Adrian Holovaty 14d6ee2dc9 Changed Query.get_columns() to quote the 'AS' column names in an extra_select situation, to match pre-queryset-refactor behavior. Added unit tests that verify this and provide an example
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7502 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 21:15:05 +00:00
Malcolm Tredinnick a97f690e5d Added the ability to pickle and unpickle QuerySets and Query classes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7499 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 14:14:41 +00:00
Malcolm Tredinnick db80f57c6e ValuesQuerySets (and subclasses) were inadvertently not caching their results.
Fixed.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7497 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 12:09:23 +00:00
Malcolm Tredinnick ba010ec1c0 Made some types of nested update queries very slightly more efficient at the
database level. Also worked around the fact that MySQL (and maybe other
backends we don't know about) cannot select from the table they're updating.

Fixed #7095.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7496 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 11:51:52 +00:00
Malcolm Tredinnick 1bb8260084 Allow Query objects to be values in query filters. This already existed for
relations, but not for normal fields. The latter comes up naturally in some
update statements.

Refs #7095


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7494 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 07:07:17 +00:00
Malcolm Tredinnick e07a457c00 Fixed #7096 -- The simplifications in [7461] weren't complete. They broke
multi-component exclude() calls. Fixed that.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7493 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 04:29:06 +00:00
Malcolm Tredinnick 356dfd5308 Fixed #7098 -- Old-style related-model order_by() syntax was being incorrectly
marked as erroneous. It's just more dangerous and risky, not forbidden. This
commit restores backwards compatibility there.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7490 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 02:27:19 +00:00
Adrian Holovaty 81edb50cac Migrated _setup_query() docstring to America
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7488 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 00:58:42 +00:00
Adrian Holovaty a209115969 Fixed a bug with the new QuerySet update() method where it wasn't committing the transaction (on Postgres, at least)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7487 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 00:58:21 +00:00
Adrian Holovaty d649d0f5f8 Fixed #7097 -- dates() queries now work as expected with select_related() -- that is, select_related() has no effect on the query. Thanks for reporting, Marco
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7486 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 00:20:40 +00:00
Malcolm Tredinnick d0c49e7b77 When retrieving a field by name, handle a missed case when the cache cannot be
initialised yet.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7478 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 11:44:11 +00:00
Malcolm Tredinnick 9c52d56f6f Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.

Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 02:50:16 +00:00
Malcolm Tredinnick 35afdedbed Fixed #6433 -- Handle some varied PostgreSQL version strings (beta versions and
Windows version strings). Patch from jerickso.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7415 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-13 02:04:10 +00:00
Ian Kelly 15a39f7fe5 Fixed #5985: Changed the lookups in the Oracle backend to use LIKEC instead of LIKE.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7412 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-10 17:44:40 +00:00
Malcolm Tredinnick c30a050e41 Removed the ado_mssql database backend.
It has not been maintained, contains bugs, and improved versions are available
externally(e.g. django-mssql and django-pyodbc at Google code).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7364 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-26 08:25:48 +00:00
Adrian Holovaty 3d779efbe5 Fixed #6867 -- Added some missing DeprecationWarnings to db.models.fields.related. Thanks, dcramer
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7362 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-25 05:13:08 +00:00
Malcolm Tredinnick 89e7b673d8 Fixed #5531 -- Changes a while back meant we are handling import errors from
database backends differently now. Which meant the MySQLdb version check was
being swallowed. Changed the exception type to ensure this is percolated
correctly. Patch from Ramiro Morales.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7358 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-24 14:02:44 +00:00
Malcolm Tredinnick b3b8422363 Fixed #6445 -- Allow model instances to be used as a default for ForeignKeys
(via a callable). Also updates the documentation of the "default" attribute to
indicate a callable can be used. Thanks, Philipe Raoult.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7331 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-20 06:56:23 +00:00
Jacob Kaplan-Moss 4457ba002d Fixed #5894: added FilePathField to newforms. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7323 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-19 22:29:11 +00:00
Malcolm Tredinnick 1b331f6c1e Fixed #6641 -- If we lose a race when creating a new object in get_or_create,
re-get the result from the database and return that. Thanks, Jeff Guinness and
Timothée Peignier.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7289 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-18 14:08:40 +00:00
Ian Kelly 4f5f8735e3 Fixed #6666: Corrected a bind param formatting issue when performing 'year' lookups on DateFields using Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7274 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-17 19:31:42 +00:00
Malcolm Tredinnick 732074541a Fixed #5883 -- Added __iter__ methods to the debug cursor and the postgresql backend cursor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7259 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-17 14:15:15 +00:00
Jacob Kaplan-Moss a9b4efc82b Re-enable substring lookups for IP address fields in Postgres using HOST() Thanks for the suggestion, Thomas Adamcik. Fixes #708.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7161 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-26 23:12:47 +00:00
Jacob Kaplan-Moss f7fbc289ad Reverted [7151] since it breaks exact IP lookups on PostgreSQL. Reopens #708
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7160 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-26 22:17:45 +00:00
Jacob Kaplan-Moss df5fef33c9 Beefed up support for "lazy" related objects. Now, in addition to ForeignKey("Model") you can also say ForeignKey("app.Model"). This means that cross-app recursive relations now work.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7158 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-26 21:13:16 +00:00
Malcolm Tredinnick 6482f1f887 Fixed #708 -- Fixed searching within IP fields on PostgreSQL.
Based on a patch from Matt McClanahan.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7151 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-23 09:15:35 +00:00
Malcolm Tredinnick 32402773f1 Fixed #3689, #5223 -- Fixed "1st of January" comparisons for SQLite without breaking the other backends.
Based on a patch from raminf and tests from Nebojsa Djordjevic.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7150 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-23 08:36:41 +00:00
Malcolm Tredinnick 6a796690e6 It makes sense that when you subclass an existing model field, you're often
going to be using the same database column type. Made that properly
inheritable (previously it was using the class name), at the cost of a little
more verboseness.

This is very slightly backwards incompatible (for subclasses of existing fields
that were relying on the old default).

Fixed #6556.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7133 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-19 02:58:41 +00:00
Malcolm Tredinnick 343fa35a2c Fixed #2936, #6500 -- Added a __hash__() method to Models (since we implement our own __eq__ method).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7132 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-19 01:59:34 +00:00
Malcolm Tredinnick f1a24be01c Fixed #6481 -- Fixed a bunch of import problems (and some whitespace cleanups).
Found by Bastian Kleineidam with help from pyflakes. Thanks.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7131 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-19 00:08:08 +00:00
Malcolm Tredinnick 16928a79e6 Tweaked [7098] to follow a more duck-typing approach.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7116 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-15 06:40:23 +00:00