Commit Graph

1093 Commits

Author SHA1 Message Date
Russell Keith-Magee 3508a86ddf Fixed #12876 -- Corrected a problem with recursive relations under deepcopy. Thanks to elachuni for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12700 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-07 07:11:22 +00:00
Joseph Kocherhans 686dac03b7 Fixed #12913. Fields with choices now respect show_hidden_initial as a keyword argument to formfield. Thanks, semenov.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12696 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-07 01:50:58 +00:00
James Bennett 98aecaa999 Fixed #13034: Corrected default error message for IntegerField.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12685 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-06 11:11:55 +00:00
Russell Keith-Magee 5670331343 Corrected an edge case introduced in r12602. Thanks to Ramiro Morales for the eagle eyes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12605 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-26 16:11:25 +00:00
Russell Keith-Magee 46cc7021a8 Fixed #1480 -- Added the ability to use the system timezone. Thanks to Ramiro Morales for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12602 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-26 15:33:27 +00:00
Russell Keith-Magee e12b3199d0 Fixed #6191, #11296 -- Modified the admin deletion confirmation page to use the same object collection scheme as the actual deletion. This ensures that all objects that may be deleted are actually deleted, and that cyclic display problems are avoided. Thanks to carljm for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12598 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-26 13:17:43 +00:00
Joseph Kocherhans ff963358d7 Fixed #12734. Deferred fields will now be properly converted to python when accessed. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12579 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-24 19:06:59 +00:00
Joseph Kocherhans 16fe73d918 Fixed #7190. Boolean fields now return bool values instead of 1 or 0. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12578 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-24 17:36:18 +00:00
Joseph Kocherhans 9f4bf525f8 Fixed #12546. Objects with a __len__ that returns 0 can now be serialized. Thanks, casobn for the report and Alex Gaynor for the patch and tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12576 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-24 15:54:03 +00:00
Joseph Kocherhans 2f45af6f58 Fixed #12818. SQLite now properly quotes strings for date extraction and truncation. Thanks, SmilyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12573 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-24 15:29:25 +00:00
Joseph Kocherhans 1089bda546 Fixed #12152. DoesNotExist and MultipleObjectsReturned now subclass their parent model's exceptions. Thanks, mattmcc and Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12567 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-24 14:32:11 +00:00
Joseph Kocherhans c05de31d75 Fixed #12731. Fixed a bug with .raw() and inheritance. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12544 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 19:39:06 +00:00
Joseph Kocherhans 65b451ae3e Fixed #12819. Fixed a bug with caching values of nullable 1to1 fields. Thanks, s.angel@twidi.com for the initial patch, and Alex Gaynor for the tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12543 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 19:24:27 +00:00
Joseph Kocherhans 7352238e16 Fixed a few more spots related to #11859. Thanks, cramm and Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12537 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 18:27:51 +00:00
Joseph Kocherhans 10b1871441 Fixed #12888. Fixed a typo in some related object error messages. Thanks, nessita.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12532 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 16:09:39 +00:00
Russell Keith-Magee c646b99453 No, really this time -- corrected the warning message from r12510.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12512 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 12:33:20 +00:00
Russell Keith-Magee ea695f8668 Cleaned up the warning message introduced by r12510.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12511 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 12:26:50 +00:00
Russell Keith-Magee 156cdcf92d Fixed #12912 -- Placed the psycopg1-backed ``postgresql`` database backend on the deprecation path.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12510 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 12:24:41 +00:00
Justin Bronn 5546430304 Fixed #12608 -- No longer return inconsistent results when using `values` and `values_list` in conjunction with `annotate`. Thanks, Charlie Leifer.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12505 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 05:26:49 +00:00
Justin Bronn c4699b0b8a Fixed #12806 -- Added an implementation of `RawQuerySet.__getitem__`. Thanks, Bruno Renié.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12504 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 05:22:12 +00:00
Justin Bronn 6ed7bd5609 Fixed #12855 -- QuerySets with `extra` where parameters now combine correctly. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12502 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 04:39:39 +00:00
Russell Keith-Magee e6db084ac8 Fixed #11226 -- Corrected an validation edge case with m2m relations between two models with the same class name. Thanks to pkoch for the report, and to Ramiro Morales for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12489 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-22 14:04:13 +00:00
Karen Tracey bb6b9aa472 Fixed #11535: Corrected SQL generated for queries involving generic relations and ORed Q objects. Thanks to brianglass for report, tobias for fix and test, and Alex for review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12405 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-10 19:21:52 +00:00
Joseph Kocherhans 225c413b08 Fixed #12647. Allow unique_together checks be specified as lists as well as tuples. Thanks, Honza Král.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12403 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-10 00:49:33 +00:00
Russell Keith-Magee b740534dc4 Fixed a regression in the Postgres psycopg cursor handling introduced by r12352. Thanks to Kenneth Gonsalves for the report, and Karen for the fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12378 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-03 07:31:00 +00:00
Joseph Kocherhans fbb42c31df Fixed #12667. Added optgroup validation support to model fields with choices. Thanks ramiro.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12374 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-02 00:41:28 +00:00
Russell Keith-Magee 9a014a3a59 Fixed #12732 -- Corrected an argument naming problem introduced by r12532. Thanks to stevedegrace for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12359 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-30 02:25:33 +00:00
Karen Tracey 199cd0efca Fixed #12721: Ensured objects with generic relations that use non-integer object ID fields can be deleted on PostgreSQL. Thanks much carljm for patch and Russ for review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12353 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-29 17:58:22 +00:00
Russell Keith-Magee 11ee9746a0 Fixed #12702 -- Introduced a common implementation of DatabaseError and IntegrityError, so that database backends can (re)raise common error classes. Thanks for Waldemar Kornewald for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12352 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-29 15:45:55 +00:00
Russell Keith-Magee 0cdd36fac8 Fixed #12718 -- Tighten up the error handling when loading database routers. Thanks to Jeff Balogh for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12336 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-28 05:55:44 +00:00
Russell Keith-Magee 58cd220f51 Fixed #7270 -- Added the ability to follow reverse OneToOneFields in select_related(). Thanks to George Vilches, Ben Davis, and Alex Gaynor for their work on various stages of this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12307 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-27 13:30:29 +00:00
Russell Keith-Magee c6ee1f6f24 Fixed #12693 -- Improved error handling when there is an error setting up the database router chain. Thanks to dhageman for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12305 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-27 07:57:18 +00:00
Russell Keith-Magee c8873bbba7 Made the database master router tolerant of router definitions that omit individual routing methods.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12304 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-27 07:56:53 +00:00
Ian Kelly 9cd1d6ed87 Fixed #11017: Changed implementation of Oracle LIKE lookups to enable index usage. Thanks to Jani Tiainen for this workaround.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12293 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-25 19:28:36 +00:00
Russell Keith-Magee 14116bc53e Fixed #12672 -- Added the ability to configure which applications are available on which database.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12290 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-25 12:23:30 +00:00
Russell Keith-Magee 6755a039eb Fixed #12542 -- Added the TEST_MIRROR setting, allowing testing of read slave databases.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12289 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-25 12:05:38 +00:00
Russell Keith-Magee 1b3dc8ad9a Fixed #12540, #12541 -- Added database routers, allowing for configurable database use behavior in a multi-db setup, and improved error checking for cross-database joins.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12272 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-22 14:30:06 +00:00
Joseph Kocherhans acc095c333 Fixed #12582. Model validation on ForeignKeys now respects limit_choices_to. Thanks, Honza Král.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12271 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-21 03:26:14 +00:00
Russell Keith-Magee b3e1162ca5 Fixed #12633 -- Modified some old m2m attribute use in deprecated m2m table creation methods. Also added PendingDeprecation warnings to those methods. Thanks to Alex for the suggestion, and Ramiro for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12262 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-19 01:25:30 +00:00
Joseph Kocherhans a2a5602b19 Fixed #12560. Changed validate_unique to stop checking null primary key values. Thanks, Honza Král.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12227 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-14 17:04:53 +00:00
Russell Keith-Magee 2b2db12032 Fixed #12386 -- Corrected the column names produced for autogenerated m2m tables when the related table is specified as a dot-separated string. Thanks to ldevesine for the report and simonb for the extra test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12226 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-14 14:55:36 +00:00
Russell Keith-Magee 6afd505b5b Fixed #5390 -- Added signals for m2m operations. Thanks to the many people (including, most recently, rvdrijst and frans) that have contributed to this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-13 11:07:16 +00:00
Luke Plant eb2cbb6db1 Fixed some bad indentation
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12210 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-12 14:26:17 +00:00
Joseph Kocherhans 2f9853b2dc Fixed #12512. Changed ModelForm to stop performing model validation on fields that are not part of the form. Thanks, Honza Kral and Ivan Sagalaev.
This reverts some admin and test changes from [12098] and also fixes #12507, #12520, #12552 and #12553.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12206 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-12 02:29:45 +00:00
Russell Keith-Magee 6c9150d818 Fixed #12558 -- Improved error handling when processing DATABASES setting. Thanks to Oliver Beattie for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12204 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-11 00:54:27 +00:00
Adrian Holovaty 5ceed0a053 Changed a whole bunch of places to raise exception instances instead of old-style raising exception classes plus a comma. Good for the future Python 3 conversion
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12180 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-10 18:36:20 +00:00
Adrian Holovaty 7c0326bcca Fixed #12537 -- Fixed error in Model.full_validate(). Thanks, gauss
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12174 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-10 17:56:52 +00:00
Adrian Holovaty cf1b6845d4 Fixed #12142 -- EmptyQuerySet.update() no longer updates all rows in the database
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12171 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-10 17:53:19 +00:00
Adrian Holovaty 18723e6e24 Fixed #10015 -- PostgreSQL 8.3+ no longer barfs when passing an integer as a filter() value for a CharField or TextField. Thanks, carljm
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12150 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-09 22:05:10 +00:00
Adrian Holovaty 2dd9a85819 Fixed #7235 -- EmptyQuerySet no longer raises and exception when it's filter()ed (along with some other QuerySet methods). Thanks, taylormarshall
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12147 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-09 21:27:39 +00:00
Jannis Leidel bacfe3f3e8 Fixed #9638 - Added %(app_label)s to the related_name format string for abstract models.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12139 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-09 20:03:52 +00:00
Jannis Leidel b7236b8576 Fixed #12059 - Let TimeField.to_python correctly return a datetime.time object when having a datetime object.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12137 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-09 20:02:41 +00:00
Jannis Leidel d7d2bdd9e9 Fixed typo introduced in r11952.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12110 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-06 00:55:54 +00:00
Joseph Kocherhans 33afa13af5 Fixed a call to .using() that didn't make it into one of the model-validation branch merges.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12106 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-05 15:39:42 +00:00
Joseph Kocherhans 1e81e2f532 Fixed another instance like [12099]. Thanks again, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12100 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-05 04:30:51 +00:00
Joseph Kocherhans 777da5bc73 Fixed a regression in validate_unique introduced in [12098]. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12099 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-05 04:12:09 +00:00
Joseph Kocherhans 471596fc1a Merged soc2009/model-validation to trunk. Thanks, Honza!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12098 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-05 03:56:19 +00:00
Russell Keith-Magee 9319f89547 Fixed #12452 -- Ensured that all connections are closed when a request is finished. Thanks to samuel@lefora.com for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12008 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-28 05:11:57 +00:00
Russell Keith-Magee a8155af4e9 Fixed #12428: Ensured that the dummy backend is installed correctly on a fresh project generated by django-admin.py startproject. Thanks to Simon for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11974 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-24 05:57:43 +00:00
Russell Keith-Magee efbace6b7e Fixed #12433 -- Corrected a typo in the text of the exception raised by RawQuery. Thanks to bjunix for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11973 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-24 05:35:43 +00:00
Ian Kelly cdf5ad4217 Changes to get raw queries working on the oracle backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11968 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22 21:05:15 +00:00
Russell Keith-Magee ff60c5f9de Fixed #1142 -- Added multiple database support.
This monster of a patch is the result of Alex Gaynor's 2009 Google Summer of Code project.
Congratulations to Alex for a job well done.

Big thanks also go to:
 * Justin Bronn for keeping GIS in line with the changes,
 * Karen Tracey and Jani Tiainen for their help testing Oracle support
 * Brett Hoerner, Jon Loyens, and Craig Kimmerer for their feedback.
 * Malcolm Treddinick for his guidance during the GSoC submission process.
 * Simon Willison for driving the original design process
 * Cal Henderson for complaining about ponies he wanted.

... and everyone else too numerous to mention that helped to bring this feature into fruition.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22 15:18:51 +00:00
Russell Keith-Magee 3d00992d9f Fixed #11936 -- Removed deferred models from the list returned by the app_cache. Thanks to ryszard for the report, and clamothe for the initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11938 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22 06:01:23 +00:00
Jacob Kaplan-Moss 20ad30713e Fixed #11863: added a `Model.objects.raw()` method for executing raw SQL queries and yield models.
See `docs/topics/db/raw.txt` for details.

Thanks to seanoc for getting the ball rolling, and to Russ for wrapping things up.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11921 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-20 02:46:58 +00:00
Luke Plant e4757ec7af Fixed #12258 - QuerySet.get() should clear ordering.
We only clear ordering when doing so cannot change the result returned by
the get() method i.e.  when the query does not already define limits.

Thanks to mattdennewitz@gmail.com for the report, and jdunck for the patch



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11916 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-19 15:02:46 +00:00
Luke Plant 7efd96844d Fixed #12251 - QuerySet.in_bulk() should accept set/frozenset
Thanks to emulbreh for patch.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11915 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-19 14:50:41 +00:00
Justin Bronn f1ea26dd99 Fixed #12234 -- Create additional indexes that use the appropriate operation class for PostgreSQL `varchar` and `text` columns when `db_index=True`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11912 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-19 08:19:38 +00:00
Jacob Kaplan-Moss 574eafe4c0 Fixed #11753 - Q objects with callables no longer explode on Python 2.4. Thanks, Jeremy Dunck.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11901 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-17 22:06:41 +00:00
Karen Tracey 5bd63663a9 Fixed #399: Added big integer field. Thanks to Tomáš Kopeček for persistently maintaining a patch for this.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11887 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-17 15:10:38 +00:00
Luke Plant b38e678dae Fixed #12389 - performance enhancement of get_models()
Thanks to Travis Cline for the patch, which gives about 35% speed increase
for the testsuite (with SQLite in-memory DB).



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11883 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-16 21:25:00 +00:00
Karen Tracey 833df0afaa Fixed #12385: Made built-in field type descriptions in admindocs translatable again. Many thanks to Ramiro for the problem report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11878 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-16 18:13:34 +00:00
Karen Tracey 0986a4d2e1 Fixed #7977: Fixed admindocs to use docstrings instead of a static array to locate type information.
Thanks J. Clifford Dyer.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11833 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-12 20:25:41 +00:00
Luke Plant eeb10d5f2c Optimised use of 'in' operator on QuerySet using an explicit __contains__ method.
Without this change, use of 'in' on a QuerySet resulted in ._result_cache
being fully populated, which sometimes is unnecessary work.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-09 16:07:21 +00:00
Russell Keith-Magee 660f9086f1 Fixed #12245 -- Corrected target app handling for auto-generated m2m models when the parent model isn't in the models module (or a subpackage thereof). Thanks to emulbreh for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11755 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-20 00:59:38 +00:00
Russell Keith-Magee 77755aa5a0 Fixed #12242 -- Corrected a problem with masking extra selects() in a DateQuerySet. Thanks to Alex Gaynor for his help debugging this one.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11748 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-19 04:35:53 +00:00
Russell Keith-Magee dd045aaab5 Fixed #12209 -- Made the through attribute on a m2m relation into a property to ensure that the fully resolved through model is always provdided. Thanks to dgouldin for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11736 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-13 12:34:41 +00:00
Russell Keith-Magee 632f12fba4 Fixed #12163 -- Corrected the unpickling of non-deferred models. Thanks to rfugger for the report and test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11732 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-11 13:06:18 +00:00
Russell Keith-Magee 70f9a4f6ce Fixed #12190 -- Corrected a regression in the ability to instantiate ForeignKeys outside of models. Thanks to jittat for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11730 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-10 15:21:12 +00:00
Russell Keith-Magee 7b63d3d3b4 Fixed #12168 -- Corrected the registration of m2m autocreated models when models.py is split into submodules. Thanks to Jens Diemer for the report and test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11724 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-05 11:57:28 +00:00
Russell Keith-Magee f9ead3fe42 Fixed #12143 -- Corrected the naming of the 'to' column in recursive m2m models. Thanks to knutin@gmail.com for the report, and Alex Gaynor for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11713 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-03 23:34:58 +00:00
Russell Keith-Magee dab3e97c1a Fixed #11795 -- Document (and slightly simplify) the use of inlines for m2m relations.
This is the first immediate benefit of m2m relations having an autogenerated model.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11712 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-03 15:02:16 +00:00
Russell Keith-Magee 585b7acaa3 Fixed #10109 -- Removed the use of raw SQL in many-to-many fields by introducing an autogenerated through model.
This is the first part of Alex Gaynor's GSoC project to add Multi-db support to Django.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11710 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-03 14:02:49 +00:00
Russell Keith-Magee 08d521efa0 Fixed #12121 -- Modified __reduce__ on a model to avoid an infinite recursion problem that occurs on Python 2.4. Thanks to emulbreh for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11691 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-01 03:04:20 +00:00
Russell Keith-Magee 96658ef2d2 Fixed #12057 -- Corrected regression of caching performance when a model contained a callable default. Thanks to Michael Thornhill for the excellent assistance tracking this problem.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11681 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-29 14:32:01 +00:00
Karen Tracey c54b8ec2f5 Fixed #12079: Changed has_results to get a single result, thus preventing exists() from always returning True on backends that support chunked reads.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11654 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-25 16:32:07 +00:00
Luke Plant 2b2f92ae8e Fixed a bug in r11646 - refs #11402
The one line of code not covered by a test... ;-)


git-svn-id: http://code.djangoproject.com/svn/django/trunk@11647 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-24 00:37:01 +00:00
Jacob Kaplan-Moss b79702b2de Fixed #11402: added a `QuerySet.exists()` method. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11646 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-24 00:28:39 +00:00
Russell Keith-Magee d56c1ab7f0 Fixed #11886 -- Corrected handling of F() expressions that use parentheses. Thanks to Brent Hagany for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11581 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-09-16 12:09:47 +00:00
Ian Kelly dcf3be7a62 Fixed #10566: Added support for cx_Oracle compiled with the WITH_UNICODE flag.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-08-24 15:45:48 +00:00
Matt Boersma e263cc0dc5 Fixed #11049: introspection on Oracle now identifies IntegerFields correctly.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11475 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-08-21 21:42:39 +00:00
Russell Keith-Magee 3412860f89 Fixed #11428 -- Ensured that SQL generating commands and dumpdata don't include proxy models in their output. Thanks to Anssi Kaariainen for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11343 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-07-27 14:32:30 +00:00
Ian Kelly bbac0cc965 Fixed #11487: pass long strings to Oracle as CLOB rather than NCLOB to prevent an encoding bug that occurs in some installations.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11285 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-07-21 21:20:18 +00:00
Russell Keith-Magee 52bc782621 Fixed #11107 -- Corrected the generation of sequence reset SQL for m2m fields with an intermediate model. Thanks to J Clifford Dyer for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11215 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-07-11 14:22:52 +00:00
Russell Keith-Magee 191203b48d Fixed #9023 -- Corrected a problem where cached attribute values would cause a delete to cascade to a related object even when the relationship had been set to None. Thanks to TheShark for the report and test case, and to juriejan and Jacob for their work on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11009 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-15 14:30:51 +00:00
Russell Keith-Magee b38cf5db5c Fixed #11311 -- Reverted [10952], Refs #10785. Changeset [10952] caused problems with m2m relations between models that had non-integer primary keys. Thanks to Ronny for the report and test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11007 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-15 11:47:01 +00:00
Gary Wilson Jr c98a46c2be Fixed #11316 -- Fixed a Python 2.3 compatibilty issue with [10966] (in Python 2.3 on 32-bit machines, 1<<32 is 0). Thanks to kylef for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11004 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-14 23:03:01 +00:00
Russell Keith-Magee 64be8f29d5 Fixed #9253 -- Modified the method used to generate constraint names so that it is consistent regardless of machine word size.
NOTE: This change is backwards incompatible for some users.

If you are using a 32-bit platform, you will observe no differences as a
result of this change. However, users on 64-bit platforms may experience
some problems using the `reset` management command.

Prior to this change, 64-bit platforms would generate a 64-bit, 16 character
digest in the constraint name; for example:

ALTER TABLE `myapp_sometable` ADD CONSTRAINT `object_id_refs_id_5e8f10c132091d1e` FOREIGN KEY ...

Following this change, all platforms, regardless of word size, will
generate a 32-bit, 8 character digest in the constraint name; for example:

ALTER TABLE `myapp_sometable` ADD CONSTRAINT `object_id_refs_id_32091d1e` FOREIGN KEY ...

As a result of this change, you will not be able to use the `reset`
management command on any table created with 64-bit constraints. This
is because the the new generated name will not match the historically
generated name; as a result, the SQL constructed by the `reset` command
will be invalid.

If you need to reset an application that was created with 64-bit
constraints, you will need to manually drop the old constraint prior
to invoking `reset`.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10966 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-09 12:59:41 +00:00
Russell Keith-Magee 031385e4cc Fixed #11194 -- Corrected loading of Proxy models from fixtures (and, by extension, save_base(raw=True) for Proxy models).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10955 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-08 13:35:39 +00:00
Russell Keith-Magee 81aedbd157 Fixed #10672 -- Altered save_base to ensure that proxy models send a post_save signal.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10954 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-08 13:04:22 +00:00
Russell Keith-Magee 6cd37e0a1f Fixed #10785 -- Corrected a case for foreign key lookup where the related object is a custom primary key. Thanks to Alex Gaynor for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-08 04:50:24 +00:00
Russell Keith-Magee 151d88af4e Fixed #11082 -- Ensured that subqueries used in an exclude(X__in=) clause aren't pre-evaluated. Thanks to Henry Andrews for the report, and clement for the fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10929 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-06 13:35:33 +00:00
Russell Keith-Magee 512ee0f528 Fixed #10572 -- Corrected the operation of the defer() and only() clauses when used on inherited models.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10926 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-06 06:14:05 +00:00
Russell Keith-Magee 2416e5fefe Fixed #9479 -- Corrected an edge case in bulk queryset deletion that could cause an infinite loop when using MySQL InnoDB.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10913 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 13:23:19 +00:00
Gary Wilson Jr bd58a3972b Fixed #11216 and #11218 -- Corrected a few typos, thanks buriy.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10861 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-29 04:35:10 +00:00
Gary Wilson Jr d89ba464dd Changes to `ImageFileDescriptor` and `ImageField` to fix a few cases of setting image dimension fields.
* Moved dimension field update logic out of `ImageFileDescriptor.__set__` and into its own method on `ImageField`.
 * New `ImageField.update_dimension_fields` method is attached to model instance's `post_init` signal so that:
   * Dimension fields are set when defined before the ImageField.
   * Dimension fields are set when the field is assigned in the model constructor (fixes #11196), but only if the dimension fields don't already have values, so we avoid updating the dimensions every time an object is loaded from the database (fixes #11084).
 * Clear dimension fields when the ImageField is set to None, which also causes dimension fields to be cleared when `ImageFieldFile.delete()` is used.
 * Added many more tests for ImageField that test edge cases we weren't testing before, and moved the ImageField tests out of `file_storage` and into their own module within `model_fields`.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@10858 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-28 05:46:09 +00:00
Russell Keith-Magee 2e24596001 Fixed #11116 -- Corrected the deletion of proxy objects. Thanks to Samuel Adam for the fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10824 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-19 13:42:38 +00:00
Russell Keith-Magee b9b9ca334e Fixed #9308 -- Corrected the updated of nullable foreign key fields when deleting objects. Thanks to Bob Thomas for the fix, and markshep for the improvements on the test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10822 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-19 12:44:17 +00:00
Matt Boersma 9140f97f9d Fixed #11033 -- handle cx_Oracle.UNICODE when driver was compiled without Unicode support. Thanks, JirkaV.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10749 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-12 20:30:28 +00:00
Matt Boersma 7b81dd4779 Fixed #11050 -- Oracle now passes all but one introspection unit test.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10743 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-11 20:55:40 +00:00
Matt Boersma 369568b8c7 Fixed #11051 -- Oracle passes null_fk unit tests in trunk again. Thanks, JirkaV.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10742 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-11 17:29:08 +00:00
Russell Keith-Magee 756d6f3a24 More fixes to PostgreSQL version comparisons from r10730.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10740 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-11 11:56:46 +00:00
Jacob Kaplan-Moss baaf29895c Fixed #10953, #10955: proxies of proxies now work correctly, though I still don't quite understand why you'd want to do such a thing. Thanks, Armin Ronacher.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10738 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-11 10:10:03 +00:00
Jacob Kaplan-Moss 2b0903b2c4 Fixed #10404: ImageField height_field and width_field options no longer depend on putting the image field after the height/width fields as they did after r9766.
This bug actually exposed a related handful of inconsistancies in the underlying file handling and wraping, so a few related changes are in here as well:

    * Dimensions are also now calculated the moment the image is assigned to the field instead of upon save.
    * The base `File` object now when possible delegates its closed attribute down to the os-level file it wrapps.
    * In-memory files' `close()` now is a no-op. Without this certain APIs that should be able to handle in-memory files were failing.
    * Accessing `FieldFile.closed` used to open the file. That's silly, and it doesn't any more.
    * Some over-eager error handling was squishing some errors that would normally be raised. One unit test was incorrectly depending on this behavior, so the test was removed.

Thanks to Armin Ronacher for much of this work.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10737 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-11 09:57:19 +00:00
Russell Keith-Magee 4f9fd44965 Corrected PostgreSQL version comparisons from r10730. Thanks to rozwell for the report on IRC.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10735 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-11 01:46:26 +00:00
Russell Keith-Magee 8c2db4ab0f Fixed #10906 -- Added a check for PostgreSQL pre 8.2 when using StdDev/Variance aggregates. Thanks to Richard Davies for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10731 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-10 09:22:53 +00:00
Russell Keith-Magee b97178f7ec Fixed #10842 -- Corrected parsing of version numbers for PostgreSQL 8.4beta series. Thanks to hgdeoro for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10730 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-10 09:22:06 +00:00
Russell Keith-Magee f824ecc363 Fixed #10958 -- Corrected the setting of PostgreSQL isolation level. Thanks to kmishler for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10728 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-10 06:23:29 +00:00
Jacob Kaplan-Moss 68a890e79f Fixed #7712, #9404, #10249, #10300: a light refactor and cleanup of file storage and the `File` object. Thanks to Armin Ronacher and Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10717 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-08 15:08:09 +00:00
Jacob Kaplan-Moss fb9ac5729d Fixed #10153: foreign key `gte` and `lte` lookups now work. Thanks, joelhooks and adurdin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10692 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-07 16:12:08 +00:00
Russell Keith-Magee fbf5eaac94 Fixed #10349 -- Modified ManyToManyFields to allow initial form values to be callables. Thanks to fas for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10652 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-02 07:03:33 +00:00
Russell Keith-Magee 5e2d38465a Fixed #10847 -- Modified handling of extra() to use a masking strategy, rather than last-minute trimming. Thanks to Tai Lee for the report, and Alex Gaynor for his work on the patch.
This enables querysets with an extra clause to be used in an __in filter; as a side effect, it also means that as_sql() now returns the correct result for any query with an extra clause.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10648 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-30 15:40:09 +00:00
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
Adrian Holovaty a21770e914 Improved the error message in case of an invalid DATABASE_BACKEND to ignore '.svn' directories in displaying the list of valid backends
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10046 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-13 04:45:11 +00:00
Adrian Holovaty d8744cca26 Fixed #10487 -- Refactored the database-backend-selection logic into a function, django.db.load_backend. Thanks to Alex Gaynor for the initial patch
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10045 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-13 04:41:45 +00:00
Ian Kelly c3dc837950 Fixed #10473: Added Oracle support for "RETURNING" ids from insert statements.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10044 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 23:41:27 +00:00
Malcolm Tredinnick 5eccc59652 Tweaked the dummy database backend initialisation.
In order to report more comphrehensible tracebacks, remove the super()
constructor call, since passing args to object.__init__ ends badly. So some
subclassing possibilities are now removed, but it's the "dummy" backend, so
we can make some compromises.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10042 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 08:52:42 +00:00
Malcolm Tredinnick a152909069 Fixed #10467 -- Fixed generated INSERT SQL for PostgreSQL 8.1 and earlier.
I introduced a bad regression in r10029, forgetting to check that some
syntax was supported. For now, you can't use autocommit=True with 8.1
and earlier (it's still available for later versions). I'll fix the
broader issue later and re-enable it for those versions, but I want to
get the SQL regression for the default path out of the code right now.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10035 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 05:32:00 +00:00
Malcolm Tredinnick c663e8fbd7 Return last insert ID correctly when the feature is enabled.
This was overlooked when merging the patch from #3460 in r10029.
Thank to Ian Kelly for noticing. Refs #10467.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10034 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 05:31:34 +00:00
Malcolm Tredinnick d4677d4bfb Slight refactoring of isolation setting from r10029.
There was a bug in the way we were reading the DATABASE_OPTIONS setting
and a lot of essentially duplicated code. This is neater.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10033 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 05:30:51 +00:00
Ian Kelly 90a3c34b35 Fixed some breakages in the Oracle test database handling from r10026.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10032 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 21:14:18 +00:00
Russell Keith-Magee 1d8e6eae34 Fixed #10463 -- Corrected a problem with the MySQL backend, introduced by [10026].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10030 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 11:03:36 +00:00
Malcolm Tredinnick 5fb6667036 Fixed #3460 -- Added an ability to enable true autocommit for psycopg2 backend.
Ensure to read the documentation before blindly enabling this: requires some
code audits first, but might well be worth it for busy sites.

Thanks to nicferrier, iamseb and Richard Davies for help with this patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10029 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 07:06:50 +00:00
Malcolm Tredinnick 0543f33bbc Fixed the django.contrib.gis test database creation as well.
Refs r10026 and r10027.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10028 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 05:48:26 +00:00
Malcolm Tredinnick 6c6edb9d04 Fixed some breakages in the test database handling from r10026.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10027 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 04:56:13 +00:00
Adrian Holovaty 315145f7ca Fixed #10459 -- Refactored the internals of database connection objects so that connections know their own settings and pass around settings as dictionaries instead of passing around the Django settings module itself. This will make it easier for multiple database support. Thanks to Alex Gaynor for the initial patch.
This is backwards-compatible but will likely break third-party database backends. Specific API changes are:

* BaseDatabaseWrapper.__init__() now takes a settings_dict instead of a settings module. It's called settings_dict to disambiguate, and for easy grepability. This should be a dictionary containing DATABASE_NAME, etc.

* BaseDatabaseWrapper has a settings_dict attribute instead of an options attribute. BaseDatabaseWrapper.options is now BaseDatabaseWrapper['DATABASE_OPTIONS']

* BaseDatabaseWrapper._cursor() no longer takes a settings argument.

* BaseDatabaseClient.__init__() now takes a connection argument (a DatabaseWrapper instance) instead of no arguments.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@10026 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 03:39:34 +00:00
Ian Kelly a4f1e48ddb Added savepoint support to the Oracle backend, necessary per the thread at http://groups.google.com/group/django-developers/browse_thread/thread/c87cf2d97478c068/
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10022 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-10 18:37:22 +00:00
Malcolm Tredinnick 326c5813b9 Removed a FIXME from the queryset-refactor days.
Turns out, nothing needed to be fixed.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10018 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-10 11:21:46 +00:00
Malcolm Tredinnick 0516c5d921 Fixed #10443 -- Fixed model attribute updating after r10003.
Adding a get_db_prep_save() call to the UpdateQuery code path meant it
was being called twice if you updated an existing model attribute. This
change removes that double call and also makes TimeField.to_python() a
little more robust for the benefit of the Oracle backend (just in case).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10013 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-10 05:24:19 +00:00
Malcolm Tredinnick b4dd4d4bb7 Fixed #3163 -- Add a "Meta.managed" option to models.
This allows a model to be defined which is not subject to database table
creation and removal. Useful for models that sit over existing tables or
database views.

Thanks to Alexander Myodov, Wolfgang Kriesing and Ryan Kelly for the bulk of
this patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10008 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-09 03:35:02 +00:00
Malcolm Tredinnick 35f934f5a7 Pass values through get_db_prep_save() in a QuerySet.update() call.
This removes a long-standing FIXME in the update() handling and allows for
greater flexibility in the values passed in. In particular, it brings updates
into line with saves for django.contrib.gis fields, so fixed #10411.

Thanks to Justin Bronn and Russell Keith-Magee for help with this patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10003 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-09 00:03:03 +00:00
Malcolm Tredinnick 6e415a5f90 Fixed #9508 -- Added an appropriate FileField.__hash__ implementation.
Required because we declare a custom __eq__ method.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9997 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-08 09:59:17 +00:00
Malcolm Tredinnick cd99c62e2d Fixed #10432 -- Handle all kinds of iterators in queryset filters.
Only consumes the iterators once and works with Python 2.3.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9986 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-08 03:32:16 +00:00
Malcolm Tredinnick 53da1e4794 Fixed #9649 -- Better error handling in model creation.
Previously, you could explicitly assign None to a non-null ForeignKey
(or other) field when creating the model (Child(parent=None), etc). We
now throw an exception when you do that, which matches the behaviour
when you assign None to the attribute after creation.

Thanks to ales.zoulek@gmail.com and ondrej.kohout@gmail.com for some
analysis of this problem.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9983 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-06 04:51:05 +00:00
Malcolm Tredinnick b5d4a8ae1b Fixed #6710 -- Made DATABASE_OPTIONS work with postgresql_psycopg2 backend.
Thanks to rcoup for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-06 02:36:56 +00:00
Malcolm Tredinnick 923f78f504 Improved table join handling for comparisons against NULL.
This fixes a broad class of bugs involving filters that look for missing
related models and fields. Most of them don't seem to have been reported
(the added tests cover the root cause). The exception is that this has
also fixed #9868.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9979 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-06 02:02:09 +00:00
Malcolm Tredinnick 7197a4dcb7 Made it explicit if you accidentally override a Field from a parent model.
This was always not working reliably (model initialization and serialization
were two of the problems). Now, it's an explicit error. Also, documented.

Fixed #10252.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9974 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-04 10:39:29 +00:00
Malcolm Tredinnick f9c8eeb311 Fixed #10406 -- Fixed some problems with model inheritance and pk fields.
Manually specifying both a OneToOneField(parent_link=True) and separate a
primary key field was causing invalid SQL to be generated. Thanks to Ramiro
Morales for some analysis on this one.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9971 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-04 07:21:14 +00:00
Malcolm Tredinnick dfd7a6c781 Fixed #10251 -- Fixed model inheritance when there's also an explicit pk field.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9970 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-04 07:20:08 +00:00
Malcolm Tredinnick 0e93f60c7f Fixed #10362 -- An update() that only affects a parent model no longer crashes.
This includes a fairly large refactor of the update() query path (and
the initial portions of constructing the SQL for any query). The
previous code appears to have been only working more or less by accident
and was very fragile.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-04 05:34:01 +00:00
Malcolm Tredinnick 14c8e5227a Changed the row count value returned from update queries in some cases.
If an update only affected an ancestor model (not the child), we were
returning 0 for the number of rows updated. This could have been
misleading if the value is used to detect an update occuring. So we now
return the rowcount from the first non-trivial query that is executed
(if any). Still a slight compromise, but better than what we had.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9966 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-04 05:33:23 +00:00
Malcolm Tredinnick c7a1a9f380 Changed the handling of as_sql() versus _as_sql() in Query/QuerySet from r9928.
This avoids inadvertently hiding AttributeError that is raised for other
reasons.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9965 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-04 04:56:20 +00:00
Malcolm Tredinnick 851461aa72 Fixed #10181 -- Handle an EmptyResultSet exception case properly in nested querysets.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9951 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-02 06:08:02 +00:00
Malcolm Tredinnick b740706707 Changed the way cache specifiers are parsed.
Allows us to reuse the same code in multiple places, avoiding new and
interesting bugs (the testing framework had a DIY version that was slightly
wrong, for example). Fixed #9833.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9936 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-01 08:13:38 +00:00
Malcolm Tredinnick 70911bf98d Fixed #8737 -- Made the PostgreSQL version number detection more flexible.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9931 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-01 07:18:57 +00:00
Malcolm Tredinnick 238477f90c Fixed #8706 -- Improved the way we detect available database backends.
Thanks, victor@egenix.com.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9930 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-01 07:12:38 +00:00
Malcolm Tredinnick 3242df16e4 To avoid an unfortunately common user-error, rename QuerySet.as_sql().
This was never a public API method, so this is backwards compatible, unless
you're poking at the internals. Refs #10352.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9928 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-01 04:12:30 +00:00
Malcolm Tredinnick c6a404d1e9 Fixed insert/update handling when no database interaction is required.
Fixed #10205 as part of this.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9926 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-01 01:56:59 +00:00
Malcolm Tredinnick bbea457fbb Fixed #10202 -- Fixed another couple of slicing edge-cases with querysets.
Patch from Alex Gaynor and Ramiro Morales.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9924 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-01 01:24:03 +00:00
Malcolm Tredinnick 415ffa8df5 Fixed #10028 -- Fixed a problem when ordering by related models.
Some results were inadvertently being excluded if we were ordering across a
nullable relation which itself ordering by a non-nullable relation.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9916 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-28 02:59:40 +00:00
Ian Kelly 8ffe8981f6 Fixed #10290: do not use aliases when adding extra_selects to the GROUP BY clause, to generate compliant sql that will be accepted by Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9905 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-25 23:56:00 +00:00
Karen Tracey 5f9ac28856 Fixed #10347 -- Fixed incorrect AttributeError raised when attempting to access a FileField without an instance. Thanks for the report and patch dc.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9902 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-24 17:24:08 +00:00
Russell Keith-Magee 7d03ca9e86 Fixed #10161 -- Modified evaluation of query expressions to allow for operators that take the form of functions. This is mostly for the benefit of Oracle, but it should prove useful later on. Thanks to Ian for the report and feedback on the fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9898 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-24 11:15:31 +00:00
Russell Keith-Magee 542709d0d1 Fixed #10182 -- Corrected realiasing and the process of evaluating values() for queries with aggregate clauses. This means that aggregate queries can now be used as subqueries (such as in an __in clause). Thanks to omat for the report.
This involves a slight change to the interaction of annotate() and values() clauses that specify a list of columns. See the docs for details.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9888 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-23 14:47:59 +00:00
Russell Keith-Magee fc02370cee Fixed #10289 -- Corrected typo that produced oversensitive rejection of Postgres versions. Thanks to Ian Kelly for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9845 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-17 23:33:30 +00:00
Karen Tracey ecc55503f4 Fixed #10196: Restored setting of image file width and height fields lost in r9766, and added tests for this function. Thanks to vicvicvic for the ticket and patch and for Alex for reminding me not to break non-PIL-boxes with the new tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9841 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-16 18:34:28 +00:00
Karen Tracey 11bfe72366 Fixed #10121: Restored code lost in r9766 that prevented overwriting an already-set blank=True FileField with blank. This would happen, for instance, in the admin if an object with a FileField was edited/saved but the file not re-uploaded, resulting in the association to the previously-uploaded file being lost. Adding the ability to re-blank FileFields when they are once set is the subject of a different ticket (#7048), for now the pre-9766 behavior here has just been restored in order to avoid unexpected data loss. Thanks to Alex for help in understanding how to fix this without un-doing the intent of r9766.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9840 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-16 17:30:12 +00:00
Russell Keith-Magee 2b1bb716ff Fixed #10248 -- Corrected handling of the GROUP BY clause when using a DateQuerySet. Thanks to Alex Gaynor for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9839 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-16 12:38:11 +00:00
Russell Keith-Magee fb64ea7896 Fixed #10132 -- Corrected the interaction of extra() queries with the values() clause. Thanks to Glen Maynard for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9838 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-16 12:29:31 +00:00
Russell Keith-Magee 58ea6d4561 Fixed #10256 -- Corrected the interaction of extra(select=) with values() and values_list() where an explicit list of columns is requested.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9837 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-16 12:28:37 +00:00
Ian Kelly e9af96de1e Fixed #10224: Don't attempt to decode binary string data in the Oracle backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9821 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-11 00:15:23 +00:00
Russell Keith-Magee f0a7470e40 Fixed #10160 -- Modified evaluation of F() expressions to protect against potential SQL injection attacks. Thanks to Ian Kelly for the suggestion and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9820 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-08 11:14:56 +00:00
Russell Keith-Magee d4a3a4b0ca Fixed #10199 -- Modified aggregate() calls to clone the base query so that the base query can be reused. Thanks to Alex Gaynor for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9819 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-08 11:14:07 +00:00
Karen Tracey addd3df3bd Fixed #7672 -- Added a 'week_day' lookup type. Many thanks to Ross Poulton for the proposal and implementation on all built-in database backends..
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9818 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-08 05:08:06 +00:00
Ian Kelly e3d64c6fca Fixed #10125: fixed the Oracle dsn construction code that was broken in [9712].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9812 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-03 22:08:57 +00:00
Russell Keith-Magee ecadf67569 Fixed #10127 -- Corrected (no, really, this time!) the way the select_related() cache is populated when annotations are also contained in the query. Thanks to Sylvain Pasche <sylvain.pasche@gmail.com> for the report and test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9808 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-03 11:07:21 +00:00
Russell Keith-Magee 8f410a577b Fixed #10127 -- Corrected handling of select_related() in annotate() calls. Thanks to Sylvain Pasche <sylvain.pasche@gmail.com> for the report and test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9805 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-02 13:43:18 +00:00
Russell Keith-Magee 65ad2132ab Fixed #10142 -- Added docs and an exploding error message to highlight an error present in the implementation of STDDEV_POP and VAR_POP in PostgreSQL 8.2-8.2.4 that will give incorrect answers (the database function mistakenly returns sample, rather than population deviation/variance). Thanks to Vinay Sajip <vinay_sajip@yahoo.co.uk> for the report, and Ian Kelly for pointing out the cause of the problem.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9804 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-02 12:03:31 +00:00
Russell Keith-Magee cf37e4624a Fixed #7210 -- Added F() expressions to query language. See the documentation for details on usage.
Many thanks to:
    * Nicolas Lara, who worked on this feature during the 2008 Google Summer of Code.
    * Alex Gaynor for his help debugging and fixing a number of issues.
    * Malcolm Tredinnick for his invaluable review notes.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9792 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-29 10:46:36 +00:00
Russell Keith-Magee 08dd4176ed Refs #10113 -- Modified the generated SQL to remove redundant GROUP BY elements, and modified the test added in [9788] to remove a test result that depended on a potentially ambiguous database ordering.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9791 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-24 14:16:25 +00:00
Russell Keith-Magee 15b1675af9 Fixed #10113 -- Ensured that joined fields mentioned in order_by() are included in the GROUP_BY clause on those backends that require it. Thanks to Koen Biermans <koen.biermans@werk.belgie.be> for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9788 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-24 06:53:54 +00:00
Russell Keith-Magee 0e15932be3 Fixed #10089 -- Corrected handling of aggregates when the query set contains no items (and the cursor returns None). Thanks to Kyle Fox for the report, and david for the initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9786 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-23 11:03:48 +00:00
Russell Keith-Magee ed3d2735a2 Fixed #10100 -- Corrected handling of the negation required exclude() clauses that reference aggregate columns. Thanks to Anossov for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9785 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-23 07:07:51 +00:00
Russell Keith-Magee 39516803f1 Fixed #10064 -- Corrected handling of aggregate queries that also use select_related(). Thanks to olivius for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9781 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-20 12:23:48 +00:00
Ian Kelly 728108883a Fixed #9275: Extended the Oracle date format to allow DATE columns to be used with DateTimeFields, especially when using legacy databases. Thanks to hollerith for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9779 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-19 20:49:12 +00:00
Matt Boersma b41a45f8e5 Fixed #5543: callproc() and friends now work with Oracle and our FormatStylePlaceholderCursor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9767 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-16 22:23:58 +00:00
Jacob Kaplan-Moss 6332ad4804 Fixed #10044: You can now assign directly to file fields (`instance.filefield = somefile`). Thanks, Marty Alchin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9766 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-16 21:48:37 +00:00
Ian Kelly 1c1425130d Fixed #6767: corrected a 2.3 compatibility issue in [9750]. Thanks to tlow.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9761 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-16 16:51:01 +00:00
Malcolm Tredinnick d579e716fe Fixed #9997 -- Fixed use of ValuesQuerySets as rvalues in filters.
Previous behaviour was pretty stupid. Let's never speak of it again. New
behaviour both works and is documented.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9759 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-16 10:59:43 +00:00
Karen Tracey 344f16e220 Fixed #8138 -- Changed django.test.TestCase to rollback tests (when the database supports it) instead of flushing and reloading the database. This can substantially reduce the time it takes to run large test suites.
This change may be slightly backwards incompatible, if existing tests need to test transactional behavior, or if they rely on invalid assumptions or a specific test case ordering.  For the first case, django.test.TransactionTestCase should be used.  TransactionTestCase is also a quick fix to get around test case errors revealed by the new rollback approach, but a better long-term fix is to correct the test case.  See the testing doc for full details.

Many thanks to:
* Marc Remolt for the initial proposal and implementation.
* Luke Plant for initial testing and improving the implementation.
* Ramiro Morales for feedback and help with tracking down a mysterious PostgreSQL issue.
* Eric Holscher for feedback regarding the effect of the change on the Ellington testsuite.
* Russell Keith-Magee for guidance and feedback from beginning to end.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9756 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-16 02:30:22 +00:00
Ian Kelly acfe5cc880 Fixed #6767: changed the way the Oracle backend fetches numbers to prevent decimals being returned as floats.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9750 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-15 20:39:09 +00:00
Karen Tracey 91e25f9ef8 Fixed #10033: In the Oracle backend, restored code lost in the aggregation merge that ensured a datetime object is returned for fields known to be datetimes, even when the time part is all zero.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9747 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-15 15:11:28 +00:00
Russell Keith-Magee 3937de4e24 Removed an redundant import from the Oracle backend. Thanks to Ramiro Morales for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9745 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-15 12:44:45 +00:00
Russell Keith-Magee cc4e4d9aee Fixed #3566 -- Added support for aggregation to the ORM. See the documentation for details on usage.
Many thanks to:
 * Nicolas Lara, who worked on this feature during the 2008 Google Summer of Code.
 * Alex Gaynor for his help debugging and fixing a number of issues.
 * Justin Bronn for his help integrating with contrib.gis.
 * Karen Tracey for her help with cross-platform testing.
 * Ian Kelly for his help testing and fixing Oracle support.
 * Malcolm Tredinnick for his invaluable review notes.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9742 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-15 11:06:34 +00:00
Malcolm Tredinnick c5bdfab9ae Fixed #9985 -- qs.values_list(...).values(...) was constructing incorrect SQL.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9717 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-08 05:49:03 +00:00
Malcolm Tredinnick d068ad0c01 Using querysets as an rvalue in filter() calls was causing an unnecessary
database query, due to a bool() call. This change stops that behaviour.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9715 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-08 05:16:21 +00:00
Malcolm Tredinnick d00c013cc8 Remove any ordering from a nested select query (in the where-clause).
This fixes r9701 for Oracle (the test introduced there did its job and failed
previously).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9714 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-08 05:15:41 +00:00
Ian Kelly c20019a91d Fixed #9972: The dbshell command was ignoring the DATABASE_HOST and DATABASE_PORT settings in Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9713 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-08 05:12:14 +00:00
Malcolm Tredinnick 0c08368116 Fixed #9862 -- For better SQL portability, don't specify "NULL" on nullable
columns when creating tables. Patch from Ian Kelly.

Columns are NULL by default, so we only need to use "NOT NULL" when we want
non-default behaviour.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9703 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-06 01:56:13 +00:00
Malcolm Tredinnick f747b61c20 Nested query support.
This extends previous functionality that allowed passing Query objects as the
rvals to filters. You can now pass QuerySets, which requires less poking at
opaque attributes. See the documentation of the "__in" lookup type for the
details.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9701 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-05 11:47:48 +00:00
Malcolm Tredinnick 062a94ef45 Reconciling where- and having-clause behaviour.
Extricated the code that works directly with SQL columns (standard
"where" stuff) from the the code that takes SQL fragments and combines
it with lookup types and values. The latter portion is now more
generally reusable. Any existing code that was poking at Query.having
will now break in very visible ways (no subtle miscalculations, which is
a good thing).

This patch, en passant, removes the existing "having" test, since the
new implementation requires more setting up than previously. The
aggregates support (currently in a separate codebase) has tests for this
functionality that work as a replacement for the removed test.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9700 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-05 11:47:14 +00:00
Russell Keith-Magee 096a9ecc5c Fixed #9942 -- Added a to_python handler for FloatField to ensure correct typing of deserialized data before saving. Underlying problem is analogous to #8298, fixed in [8515]. Thanks to David Larlet <larlet@gmail.com> for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9695 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-03 04:43:58 +00:00