Commit Graph

155 Commits

Author SHA1 Message Date
Jacob Kaplan-Moss 7ecdf47bd0 Fixed #8115: avoid a infiniate loop when collecting related objects for deletion.
I can't reproduce the original error leading to #8115 and the patch. However, the only harm this change could cause is to raise more `CyclicDependency` exceptions than strictly necessary. That's better than infinite loops, at least, and it's easier to clean up in the future when we figure out the actual fix.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8807 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 19:35:03 +00:00
Malcolm Tredinnick 51836756d0 Fixed a typo from the refactoring in [8455]. With bonus test, too. Thanks, vung.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8724 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-29 22:29:38 +00:00
Malcolm Tredinnick c181734fa1 Changed create() and get_or_create() to force an insert (not update an existing value).
Backwards incompatible if you are using manually-specific primary key values
and relying on the previously documented behaviour that the new values would
always exist in the database (i.e. it would update the existing entry).

Fixed #8419.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8670 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-28 17:18:05 +00:00
Malcolm Tredinnick 8f5234d801 Fixed #8036 -- Fixed a case when attempting to traverse non-existent related
instances. We weren't skipping the correct output columns before processing
subsequent existing related instances. Thanks to mrmachine for the test case.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8598 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-26 20:44:20 +00:00
Malcolm Tredinnick aba518f0f8 Removed a relatively pointless QuerySet clone introduced in [8472].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8499 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-23 18:34:32 +00:00
Malcolm Tredinnick d4d7bc175d Fixed #8046 -- The first filter() call on a related manager for many-to-many
fields no longer creates duplicate copies of the join table(s). Basically, this
means filters on the join table (for ManyToManyField(through=...)) and complex
filters in the normal (non-through) case don't produce incorrect or duplicate
results.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8472 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-22 22:00:28 +00:00
Malcolm Tredinnick b9407b26df Made it possible to pickle DateQuerySets.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8455 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-20 22:38:15 +00:00
Gary Wilson Jr ddc156bca2 Fixed #6970 -- Raise the original `IntegrityError` when all required fields aren't specified in `get_or_create` instead of a misleading `DoesNotExist` error, thanks deadwisdom.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8398 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15 23:29:55 +00:00
Matt Boersma fcc42c1bf7 Fixed Oracle backend test case failure in modeltests\lookup.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8355 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15 01:33:18 +00:00
Malcolm Tredinnick 3eb8074808 Added savepoint protection to get_or_create() to avoid problems on PostgreSQL.
Fixed #7402.

Also made savepoint handling easier to use when wrapped around calls that might
commit a transaction. This is tested by the get_or_create tests.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8315 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 05:59:43 +00:00
Malcolm Tredinnick dc14b29fb3 Added the ability to force an SQL insert (or force an update) via a model's
save() method.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8267 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-09 17:19:23 +00:00
Jacob Kaplan-Moss 34a3bd5225 Major refactoring of django.dispatch with an eye towards speed. The net result is that signals are up to 90% faster.
Though some attempts and backwards-compatibility were made, speed trumped compatibility. Thus, as usual, check BackwardsIncompatibleChanges for the complete list of backwards-incompatible changes.

Thanks to Jeremy Dunck and Keith Busell for the bulk of the work; some ideas from Brian Herring's previous work (refs #4561) were incorporated.

Documentation is, sigh, still forthcoming.

Fixes #6814 and #3951 (with the new dispatch_uid argument to connect).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-06 15:32:46 +00:00
Gary Wilson Jr 06885f37be Removed unused warnings import that should have been removed in [8191], refs #7830.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8199 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-03 17:26:50 +00:00
Gary Wilson Jr 351a3ca154 Removed several deprecated features for 1.0 (refs #7830):
* "simple" cache backend
 * `ObjectPaginator`
 * `edit_inline_type` argument for `ForeignKey` fields
 * `QOperator`, `QNot`, `QAnd` and `QOr`
 * `maxlength` argument 


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8191 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-02 04:56:11 +00:00
Malcolm Tredinnick 19c7db0058 Fixed #7853 -- Fixed another case of deleting inherited models with foreign key
references. Thanks to Russell for the test case that demonstrated the problem.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8128 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-28 01:32:46 +00:00
Malcolm Tredinnick 3cbe73692e Fixed #7778 -- Fixed a tricky case of foreign key clearing with inherited
models. Patch from James Murty.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8100 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-27 04:18:52 +00:00
Malcolm Tredinnick f48855178d Fixed #7530, #7716 -- When using select_related() and encountering a NULL
related object, populate the attribute correctly. Patch from Bastien Kleineidam.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8098 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-27 01:18:23 +00:00
Malcolm Tredinnick 52fdedba48 Fixed #7759 -- Fixed QuerySet.count() when the results cache was only partially
populated.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7938 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-16 23:17:29 +00:00
Gary Wilson Jr dee7de0c23 Re-organized imports, removing a couple that were unused.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7912 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-13 01:22:31 +00:00
Gary Wilson Jr 1bb8809561 Added a docstring to CyclicDependency exception class.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7911 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-13 01:17:23 +00:00
Malcolm Tredinnick e47d8e7fb1 Fixed #7734 -- Fixed a Python 2.3 compatibility problem.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7910 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-12 23:25:22 +00:00
Gary Wilson Jr 96a47da015 Fixed a couple typos as well as several minor style issues.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7871 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-08 21:53:38 +00:00
Malcolm Tredinnick 5326cd293e Factored out a semi-complex if-test that was used in two places.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7782 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-29 09:40:17 +00:00
Malcolm Tredinnick 36cb438373 Fixed #7312 -- Fixed handling of custom Q-like objects in QuerySet.custom_filter().
This is pretty much internal-use-only code, so doesn't affect public API at
all, but it's nice to be able to handle things properly in any case. Patch from
emulbreh.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7766 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 13:25:59 +00:00
Malcolm Tredinnick 9e23c3c5d9 EmptyQuerySet classes can now be merged with normal querysets.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7765 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 11:42:12 +00:00
Malcolm Tredinnick 279fc8599b Fixed #7105 -- Fixed dates() queries in light of model inheritance.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7763 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 07:51:19 +00:00
Malcolm Tredinnick 002dbd16b4 Removed the bulk of the sanity checking when merging QuerySets.
It was causing too many inconvenient and unintended problems when merging
legitimate subclasses (e.g. with geo-django classes). There's still a hook
there that we use when merging ValueQuerySets, but if you try to merge two
disparate QuerySets and it breaks all that happens is you get to keep both
pieces. We're no longer penalising the useful usages just for the people who
aren't concentrating.

Fixed #7113.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7742 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 02:20:45 +00:00
Russell Keith-Magee b8f7b39ccc Fixed #7155 -- Corrected DateQuerySet to handle nullable fields. Thanks to fcaprioli@alice.it for the original report and patch, and to Jeremy Dunck for the test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7739 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-25 13:38:06 +00:00
Luke Plant b1851cca3e Fixed bug with Model.delete() which did not always delete objects in the right order.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7722 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-21 20:57:05 +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
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
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
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
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
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 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
Malcolm Tredinnick 805c364fcf Fixed #3511 -- Changed QuerySet.get() to return a MultipleObjectsReturned exception, rather than an assertion error. Thanks, Gary Wilson and cheeming.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6838 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02 18:21:07 +00:00
Jacob Kaplan-Moss 960c1263b6 Fixed #5559: instances sent via post-save signals no longer have pks of None. Thanks, Joseph Kocherhans.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6411 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-24 18:27:42 +00:00
Matt Boersma a6b1d65e33 Fixed #5226. Now we check the Oracle version and give an explicit
error when we encounter a regex operator that isn't supported on 9i or 
earlier.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6198 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 18:26:07 +00:00
Adrian Holovaty 14db37319b Refactored OPERATOR_MAPPING so that it exists as django.db.connection.operators instead of django.db.backend.OPERATOR_MAPPING. Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5982 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:26:55 +00:00
Adrian Holovaty 4c5248f98f Refactored get_field_cast_sql() to DatabaseOperations.field_cast_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5977 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:03:40 +00:00
Adrian Holovaty e13ea3c70d Refactored get_query_set_class() to DatabaseOperations.query_set_class(). Also added BaseDatabaseFeatures.uses_custom_queryset. Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5976 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 02:39:05 +00:00
Adrian Holovaty 1a8f9b2b97 Implemented BaseDatabaseFeatures and changed all code to access it -- connection.features.foo instead of backend.foo
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5974 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 02:20:33 +00:00
Adrian Holovaty 221f99ed58 Refactored quote_name() to DatabaseOperations.quote_name(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:03:33 +00:00
Adrian Holovaty c44fb66551 Refactored get_random_function_sql() to DatabaseOperations.random_function_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5962 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:04:20 +00:00
Adrian Holovaty d3e69c3a47 Refactored get_limit_offset_sql() to DatabaseOperations.limit_offset_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5959 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:24:59 +00:00
Adrian Holovaty 5a6426448f Refactored get_fulltext_search_sql() to DatabaseOperations.fulltext_search_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5957 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:13:06 +00:00
Adrian Holovaty 29f67dce9e Refactored get_datetime_cast_sql() to DatabaseOperations.datetime_cast_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5953 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:55:05 +00:00
Adrian Holovaty 5f51f0524a Refactored get_date_trunc_sql() to DatabaseOperations.date_trunc_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:47:43 +00:00
Adrian Holovaty aab04a4c2f Refactored get_date_extract_sql() to DatabaseOperations.date_extract_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5951 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:40:06 +00:00
Malcolm Tredinnick 7e8efcd4d9 Fixed #5087 -- Fixed support for TextField filtering with Oracle. Thanks, Ian Kelly.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5943 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 12:37:00 +00:00
Gary Wilson Jr 049212e950 Fixed #5115 -- Fixed `QuerySet` slices to allow longs.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5831 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-08 21:09:55 +00:00
Adrian Holovaty 5b8d2c9f0d Fixed bug with using values() and extra(select) in the same QuerySet, with a select dictionary containing more than a few elements. This bug was identified in unit test from [5767]. The problem was that we were relying on the dictionary's .items() ordering, which is undefined
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5768 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-27 22:07:42 +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
Jacob Kaplan-Moss 24512a74be Fixed #1465: added support for regex lookups. Thanks, Tom Tobin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5555 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-27 18:58:10 +00:00
Malcolm Tredinnick ac64e91a0c Merged boulder-oracle-sprint branch (r3965:5512) back into trunk. All
expected tests pass for all databases.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5519 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-23 14:16:00 +00:00
Malcolm Tredinnick 08aa5c585b Fixed #4607 -- Tweaked checks for features missing in Python 2.3 to not assume
things Python does not guarantee. Patch from SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5514 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-23 03:18:22 +00:00
Jacob Kaplan-Moss bf2e62aa3c Fixed #3050: you can now use extra(select=...) with values(). Thanks, Honza Kral
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5385 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-31 02:22:41 +00:00
Malcolm Tredinnick 1c53661bd1 Moved generic relations into django.contrib.contenttypes, since it depends on
that to work. Backwards incompatible change.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5172 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-08 10:59:35 +00:00
Adrian Holovaty 1889db475d Fixed comma splice in error message introduced in [5133]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5154 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-06 04:12:08 +00:00
Malcolm Tredinnick d943f5ae92 Fixed #4130 -- Added more self-explanatory error message when a typo is made in
a queryset field argument.

We may need to fine-tune the error message based on experience down the line,
but this stands as an improvement on its own. Thanks, Ned Batchelder.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5133 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-01 03:21:54 +00:00
Adrian Holovaty 4ee7a7be95 Negligible space changes to django/db/models/query.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4986 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-09 15:35:19 +00:00
Russell Keith-Magee bbeb62c9af Backwards-incompatible change -- Removed LazyDate helper class. To preserve existing functionality, query arguments can now be callable. Callable query arguments are evaluated with the query is evaluated.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4985 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-09 13:28:09 +00:00
Malcolm Tredinnick 858ac05802 Fixed #2351 -- Fixed problem with using ".count" attribute of QuerySets in
templates.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4772 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-22 03:00:12 +00:00
Russell Keith-Magee 55a67ae3f0 Fixed #3738 -- Minor inline documentation fix. Thanks, Simon.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4754 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-20 11:09:40 +00:00
Jacob Kaplan-Moss 4477f50f0b Added a "depth" argument to select_related() to control how many "levels" of relations select_related() is willing to follow (refs #3275).
Also added unit tests for select_related().

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4645 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-28 15:24:05 +00:00
Jacob Kaplan-Moss f2aa1b93e0 Fixed silly typo in [4651].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4563 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-23 23:05:25 +00:00
Jacob Kaplan-Moss 16bd0aa991 Fixed #3541: queryset.count() now respects the queryset cache.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4561 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-23 20:58:28 +00:00
Adrian Holovaty 4c4209b144 Changed __year lookup to use a BETWEEN SQL statement instead of comparing the result of EXTRACT(year). This should be more efficient.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4505 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-14 06:32:32 +00:00
Malcolm Tredinnick d123588184 #fixed #2256 -- Made count() interact with slicing on QuerySets. Patch from
SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4488 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-12 00:16:17 +00:00
Adrian Holovaty 007f17d63e Fixed #3463 -- EmptyQuerySet's iterator() now returns a generator. Thanks, Gary Wilson
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4475 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-10 05:38:38 +00:00
Malcolm Tredinnick e57ce6b157 Fixed #2348 -- Improved error reporting when query filter arguments are
misspelt. Variation on a patch from Karen Tracey.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4470 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-10 03:39:56 +00:00
Russell Keith-Magee 12ad69c0b4 Fixed #3215, #3081, #2749 -- Fixed problem with mistaken deletion of objects when a GenericRelation is involved. Thanks to Thomas Steinacher for helping to narrow down the problem (#3215), and Alex Dedul (#3081) for the starting point of a working patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4428 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-25 11:24:17 +00:00
Adrian Holovaty 13280259a8 Fixed #3283 -- Added support for empty QuerySets via none() method. Thanks for the patch, medhat
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4394 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-23 02:11:08 +00:00
Russell Keith-Magee ddb9b7d57a Fixed #2473 -- Added special case for '__in=[]' (empty set) queries, because 'WHERE attr IN ()' is invalid SQL on many backends. Thanks, Gary Wilson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4283 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-04 04:00:16 +00:00
Russell Keith-Magee fbbbf8b9a1 Fixes #2737 -- Added code to allow None as a query value for __exact queries, raising an error otherwise. __exact=None is interpreted as the SQL 'value = NULL'. This fixes some minor problems with queries on unsaved objects with related object sets, and stops queries with a value of None being outright ignored (even if they reference an unknown attribute).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3902 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-10-14 02:48:05 +00:00
Russell Keith-Magee 0c41869e6c Made ``pk`` a generic expansion for the primary key, rather than just an expansion for __id__exact.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3826 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-25 13:49:01 +00:00
Adrian Holovaty be2524182b Fixed #2379 -- Fixed 'search' DB lookup parameter, which was broken by [3248]. Thanks, Tim Keating
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3400 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-20 20:13:35 +00:00
Adrian Holovaty 33f47ae30a Added local 'qn' variable for backend.quote_name in django.db.models.query.delete_objects
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3327 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-11 04:11:40 +00:00
Adrian Holovaty cfcd4a5875 Added local 'qn' variable for backend.quote_name in django.db.models.query.fill_table_cache
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3326 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-11 03:35:17 +00:00
Adrian Holovaty 98597be786 Removed references to LOOKUP_SEPARATOR in django.db.models.query.lookup_inner
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3325 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-11 03:29:12 +00:00
Adrian Holovaty 9a0e56dbb5 Removed unnecessary 'except: raise' in django.db.models.query.lookup_inner
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3324 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-11 03:27:29 +00:00
Adrian Holovaty a17a9d1474 Added local 'qn' variable for backend.quote_name in django.db.models.query.lookup_inner
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3323 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-11 03:27:10 +00:00
Adrian Holovaty c262e19670 Renamed 'clause' variable to 'lookup_type' in django.db.models.query.lookup_inner
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3322 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-11 03:21:59 +00:00
Adrian Holovaty b4b9edc5e5 Fixed #1614 -- get_sql(), lookup_inner() and parse_lookup() no longer return a 'tables' parameter, because 'tables' was never getting assigned, anywhere.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3317 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-11 02:32:53 +00:00
Adrian Holovaty 78c91dd7df Made two small changes to comments in django.db.models.query
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3300 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-08 14:17:45 +00:00
Adrian Holovaty ec23edfc7f Formatting fix for [3248]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3250 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-01 03:21:32 +00:00
Russell Keith-Magee cd7b54aab0 Fixes #2271 -- Added code to imply !__exact on any query argument that doesn't finish with a known query term.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3248 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-01 03:14:33 +00:00
Russell Keith-Magee c81d69354a Fixed #2217 -- Allowed raw objects to be used in __exact and __in query terms. Existing use of primary keys in query terms is preserved.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3246 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-01 01:14:41 +00:00
Jacob Kaplan-Moss 48562965b9 Added {{{Manager.create()}}} method to create and save an object in a single step.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3217 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-27 20:36:25 +00:00
Adrian Holovaty 2abfd5dd58 Fixed #2109 -- Convert old-style classes to new-style classes throughout Django. Thanks, Nicola Larosa
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3113 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-08 05:00:13 +00:00
Adrian Holovaty b3a6348bc2 Added Manager.get_or_create()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3092 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-07 00:09:29 +00:00
Adrian Holovaty 168429d597 Fixed #593 -- Added 'search' DB-API lookup type, which does full-text index searches in MySQL
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3073 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-03 23:28:24 +00:00
Adrian Holovaty b4be0d2487 Fixed #1454 -- Improved DB API quote_only_if_word() so that it doesn't quote 'select' parameters that are not all word characters. Thanks, dja@cdc.msbx.net
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3044 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-01 04:47:56 +00:00
Adrian Holovaty 45518a052b Fixed #2038 -- QuerySet._combine now combines where clause. Thanks, graham@darkcoding.net
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3019 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-31 14:52:33 +00:00
Luke Plant 60c3e55b1f Fixed bug with QuerySet.exclude() failing to do negations on Q objects, and
at the same time generalised exclude/QNot so that they work for 'external'
Q objects i.e. ones that simply have 'get_sql' defined.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@2997 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-26 23:41:43 +00:00
Luke Plant 0c8ac0972c Made negative indexing on QuerySet instances raise an assertion error (previously
it just returned incorrect results).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@2992 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-26 18:41:03 +00:00
Luke Plant a666b98783 Fixed bug with Meta.ordering being ignored when slicing a single item off a QuerySet. Thanks, Gábor Fawkes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2970 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-23 19:55:30 +00:00
Malcolm Tredinnick 1006d6eb06 Fixed #1530 -- make count() respect distinct() on QuerySets. Create some
tests for this as well. Thanks to Adam Endicott for the original patch on which
this is based.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@2902 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-14 23:49:29 +00:00