Commit Graph

731 Commits

Author SHA1 Message Date
Carl Meyer 84291b7b84 Fixed #15161 - Corrected handling of ManyToManyField with through table using to_field on its ForeignKeys. Thanks to adehnert for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15330 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-26 19:10:08 +00:00
Carl Meyer 33c155679c Fixed Python 2.4 incompatibility introduced in r15249.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15329 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-26 18:20:19 +00:00
Carl Meyer a9b4f2a400 Tweaked r15303 to avoid O(N) lookup of field name. Thanks to Alex's eagle eyes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15324 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-26 08:39:30 +00:00
Carl Meyer 00e7a571c5 Fixed #6456 - Excised FileField file deletion to avoid data loss. Thanks to durdinator for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15321 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-26 07:46:19 +00:00
Alex Gaynor 80287f1e8a Fixed #13159 -- properly quote aggregates in order_by.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15318 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-26 03:48:15 +00:00
Alex Gaynor 91414c4bb8 Fixed #13206 -- call super().__init__() in Model.__init__ to allow mixins to do things there.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15317 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-26 03:42:31 +00:00
Carl Meyer 227c5e80db Fixed #11319 - Added lookup support for ForeignKey.to_field. Also reverted no-longer-needed model formsets workaround for lack of such support from r10756. Thanks Russell and Alex for review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15303 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-25 03:14:28 +00:00
Carl Meyer 93a4d46184 Fixed #14672 - Added admin handling for on_delete=PROTECT. Thanks to jtiai for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15249 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-20 00:33:32 +00:00
Carl Meyer e01cb07404 Fixed #14896 -- Ensured that _meta.get_all_related_objects(include_hidden=True) also works correctly with model inheritance.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15248 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-19 21:56:14 +00:00
Carl Meyer 621f48086e Fixed #15118 - Corrected the deletion-ordering for inherited models.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15246 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-19 20:11:56 +00:00
Alex Gaynor a38da1ae0d Avoid doing quadratic amounts of work during object deletion.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15243 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-19 14:39:54 +00:00
Russell Keith-Magee ae8ff5f476 Fixed #14707 -- Relax the protections on aggregate naming collisions when a ValuesQuerySet removes the colliding name. Thanks to Andy McKay for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-16 08:03:25 +00:00
Alex Gaynor 92d4352283 Cleaned up the ORM slightly.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15203 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-14 05:04:14 +00:00
Ramiro Morales e1ede214e6 Fixed #13668 -- Corrected database router methods invocation for ManyToMany fields without through models. Thanks craig.kimerer for the report and David Gouldin for the fix.
This also adds tests for r14857.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15185 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-13 04:11:41 +00:00
Alex Gaynor 29de7ee9cb Fixed #11293 -- fixed using Q objects to generate ORs with aggregates.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15173 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-11 01:00:50 +00:00
Andrew Godwin ea774bf9a7 Fix wrong attribute name in [15156]. Thanks to Alex Gaynor for spotting this.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15169 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-10 13:44:35 +00:00
Ramiro Morales 730769d1af Fixed #14951 -- Made the unique_for_{date,month,year} model field constraints to not fail when the related DateField is empty.
Existing modelforms tests were extended to cover this case and an equivalent set of tests was added for the model functionality.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15167 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-09 13:26:39 +00:00
Andrew Godwin 81e05a418d Fixed #9029 -- Allow use of fieldname_id with get_or_create. Thanks to aaron and mrmachine.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15156 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-08 13:27:30 +00:00
Karen Tracey b1f6a4d66f Fixed #10154: Allow combining F expressions with timedelta values.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15018 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-22 03:34:04 +00:00
Jannis Leidel 88ff656731 Fixed #12955 -- Use the size attribute of the file instead of len() to support uploads larger than 2GB. Thanks, swiedenroth and isagalaev.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14878 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-12 22:54:22 +00:00
Russell Keith-Magee 52c77803d2 Normalized the name order of arguments. There's no actual bug here, other than potential confusion for anyone reading the code. Thanks to Aram Dulyan for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14796 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-04 05:59:38 +00:00
Alex Gaynor d68598e022 Fixed #14700 -- ensure that a raw query is only executed once per iteration.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14785 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-03 20:25:59 +00:00
Alex Gaynor 21f5dc467e Fixed a bug in date queries with GIS backends introduced in [14715].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14760 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-01 17:53:22 +00:00
Alex Gaynor 678f626c24 Fixed a suite of errors in the ORM -- a) fixed calling values_list().values_list() and changing whether the results are flat, b) fixed an issue with fields on the left-hand side of what becomes the HAVING clause not being included in the GROUP BY clause, and c) fixed a bug with fields from values() calls not being included in the GROUP BY clause. This fixed the recent test failures under postgresql.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14715 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-26 14:24:08 +00:00
Luke Plant 073412b411 Fixed #14700 - speed up RawQuerySet iterator.
This moves constant work out of the loop, and uses the much faster *args
based model instantiation where possible, to produce very large speed ups.

Thanks to akaariai for the report and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14692 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-24 15:26:29 +00:00
Luke Plant ff7c243b4c Fixed #14697 - speeded up model instance creation by moving work outside of loops
Thanks to akaariai for the report and initial patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14687 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-23 13:54:58 +00:00
Alex Gaynor 07ba3220ba Fixed #14754 -- corrected using an aggregate in an F expressions when that queryset is later used in a subquery. Thanks to master for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14681 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-22 18:00:01 +00:00
Honza Král dc334a2ba8 Fixed #3400 -- Support for lookup separator with list_filter admin option. Thanks to DrMeers and vitek_pliska for the patch!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14674 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-21 19:29:15 +00:00
Carl Meyer 9b432cb67b Fixed #5768 -- Added support for ManyToManyFields and reverse relations in values() and values_list(). Thanks to mrmachine for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14655 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-21 02:28:25 +00:00
Carl Meyer 008f333bac Fixed pk uniqueness validation for new objects created outside of a ModelForm. Also removed need for ModelForm to poke at Model._state.adding, keeping it an internal ORM concern.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14613 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-18 23:29:58 +00:00
Carl Meyer 38ba3775ec Fixed #14234 -- Re-validating a model instance added via ModelForm no longer throws spurious PK uniqueness errors. Thanks to David Reynolds and Jeremy Dunck.
Also moved Model._adding to Model._state.adding to reduce instance namespace footprint.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14612 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-18 22:43:46 +00:00
Alex Gaynor fc47f8c65a Fixed #14257 -- removed ManyToManyField.isValidIDList which was completely dead code (unused since magic-removal). Thanks to andrewsk for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14602 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-17 17:00:40 +00:00
Alex Gaynor 0eb31d3dc9 Fixed #14423 -- corrected incorrect SQL being generated when a nullable, inherited field was used in an exclude. Thanks to PhiR_42 for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14600 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-17 16:46:50 +00:00
Ramiro Morales 5666bca678 Fixed #11369 -- Corrected verbose_name_plural model Meta option to be consistent with verbose_name when using abstract model inheritance. Thanks Beetle_B for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14588 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-17 12:09:21 +00:00
Alex Gaynor 4276b5197b Fixed #12687 -- fixed an issue with aggregates and counts in conjunction with annotations where the QuerySet was provably empty.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14586 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-17 02:57:14 +00:00
Ramiro Morales f3d0704783 Fixed #14691 -- Made ForeignKey.validate() use the right database. Thanks Marco Paolini for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14580 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-16 22:09:13 +00:00
Carl Meyer 616b30227d Fixed #7539, #13067 -- Added on_delete argument to ForeignKey to control cascade behavior. Also refactored deletion for efficiency and code clarity. Many thanks to Johannes Dollinger and Michael Glassford for extensive work on the patch, and to Alex Gaynor, Russell Keith-Magee, and Jacob Kaplan-Moss for review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14507 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-09 16:46:42 +00:00
Alex Gaynor e2a0de0b93 Fixed a test failure introduced in [14461].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14462 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-04 16:37:00 +00:00
Alex Gaynor abaa3ed4bd Fixed #13935, added support for using QuerySet.dates across related fields. Thanks to valyagolev for his work on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14461 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-04 16:03:05 +00:00
Alex Gaynor 222c732616 Fixed #10728 -- corrected subclassing of Fields who use the SubfieldBase metaclass. Thanks to G2P and George Sakkis for their work on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14443 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-02 18:40:53 +00:00
Alex Gaynor c38a174f7c Remove several uses of the deprecated dict.has_key in favor of the in operator. This is faster, has less code, and is in every single way better.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14392 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-29 04:24:53 +00:00
Russell Keith-Magee 8a724802c5 Fixed #14471 -- Corrected a regression in the use of methods on custom managers on related querysets. Thanks to Lucky for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14389 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-28 12:57:04 +00:00
Chris Beaven 65b98c9b41 Change the stacklevel for Field deprecation warnings to correctly point to the source of the problem
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14220 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-15 02:09:11 +00:00
Ramiro Morales 08d14925c9 Fixed #12192 -- Don't execute any DB query when the QS slicing being performed
will result in use of LIMIT 0. Thanks Suor for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14204 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-13 23:36:16 +00:00
Russell Keith-Magee 1070c57b83 Fixed #14436 -- Escalated 1.2 PendingDeprecationWarnings to DeprecationWarnings, and removed 1.1 deprecated code.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14138 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-11 12:20:07 +00:00
Carl Meyer 2f17dd3dd0 Refs #11256 -- Extended the annotation field name conflict check to cover m2ms and reverse related descriptors as well. This is needed to actually cover the case raised by #14373.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14116 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-10 08:04:14 +00:00
Carl Meyer 1fe1af93a5 Added sanity-checking of annotation alias names.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14092 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-09 20:07:48 +00:00
Alex Gaynor 560fedde4c Fixed #14366 -- Model.objects.none().values() now correctly returns a QuerySet with no items, rather than raising an Exception. Thanks to Carl Meyer for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14084 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-09 16:45:58 +00:00
Russell Keith-Magee a904e55859 Fixed #11509 -- Modified usage of "Web" to match our style guide in various documentation, comments and code. Thanks to timo and Simon Meers for the work on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14069 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-09 08:12:50 +00:00
Alex Gaynor ccc43508e3 Fixed #13241. order_with_respect_to now works with ForeignKeys who refer to their model lazily (i.e. with a string). Thanks to Gabriel Grant for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14045 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-08 23:54:43 +00:00