Commit Graph

1169 Commits

Author SHA1 Message Date
Jacob Kaplan-Moss 63d85a684a Fixed #8630: finished the custom comment app API that was left out of 1.0. This means it's now possible to override any of the models, forms, or views used by the comment app; see the new custom comment app docs for details and an example. Thanks to Thejaswi Puthraya for the original patch, and to carljm for docs and tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9890 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-23 22:16:26 +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
Brian Rosner 4bd24474c0 Fixed #10274 -- Fixed an embarrassing mistake in BaseGenericInlineFormSet.get_queryset. Thanks Zak Johnson for the report and akaihola for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9886 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-23 04:30:38 +00:00
Russell Keith-Magee b2a4377651 Fixed #9066 -- Added Czech localflavor. Thanks to Elvard for the contribution.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9876 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-22 07:51:57 +00:00
Jacob Kaplan-Moss 8ada8d7c03 Fixed #9214: EmailMessage now respects the From header instead of blindly using from_email. Thanks, Tai Lee.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9842 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-16 20:47:39 +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
Brian Rosner e5cd43e588 Fixed #5903 -- DecimalField.get_default() now correctly returns a Decimal object when the model instance was not retrieved from the database. Thanks Justin Driscoll and pigletto.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9823 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-11 20:13:17 +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
Karen Tracey 81ae2afdec Fixed 10075: Allowed saving of inline-edited models that use multi-table inheritance.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-03 14:02:09 +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
Ian Kelly c08e0ef649 Fixed some tests that relied on an arbitrary ordering of rows.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9800 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-30 20:15:41 +00:00
Ian Kelly bd40c32f6c Fixed some column names in the tests that were breaking the test suite on Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9799 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-30 20:02:42 +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
Karen Tracey ef22bb7b33 Fixed #10103: Testcase fix for Jython compatibility. Thanks for report and patch leosoto.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9782 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-23 04:53:18 +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
Karen Tracey 795c229ae9 Fixed #10069 -- Fixed the model form unique validation code to not proceed with using, for example, RelatedObjects returned by get_field_by_name as though they were model Fields.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9777 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-19 19:37:31 +00:00
Karen Tracey dd2e1356f0 Corrected code in serializers_regress testcase so that, in the case where an exception has been raised, rollback is called before attempting to leave transaction management. With the old code the original exception (IntegrityError on InnoDB) was getting hidden by a transaction management error resulting from attempting to leave transaction management with a pending commit/rollback.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9773 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-18 20:54:42 +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
Jacob Kaplan-Moss 79138a6106 Fixed #10041: use a tempdir for files in the forms test. Thanks, Marty Alchin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9765 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-16 21:31:58 +00:00
Matt Boersma b120c74032 Changed "date" column to "start_date"--Oracle won't name columns with reserved keywords.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9764 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-16 21:18:21 +00:00
Jacob Kaplan-Moss f212b24b64 Cleaned up and refactored `ModelAdmin.formfield_for_dbfield`:
* The new method uses an admin configuration option (`formfield_overrides`); this makes custom admin widgets especially easy.
  * Refactored what was left of `formfield_for_dbfield` into a handful of smaller methods so that it's easier to hook in and return custom fields where needed.
  * These `formfield_for_*` methods now pass around `request` so that you can easily modify fields based on request (as in #3987).

Fixes #8306, #3987, #9148.

Thanks to James Bennet for the original patch; Alex Gaynor and Brian Rosner also contributed.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9760 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-16 15:32:31 +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
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
Jacob Kaplan-Moss 1f84630c87 Fixed #6470: made the admin use a URL resolver.
This *is* backwards compatible, but `admin.site.root()` has been deprecated. The new style is `('^admin/', include(admin.site.urls))`; users will need to update their code to take advantage of the new customizable admin URLs.

Thanks to Alex Gaynor.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9739 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-14 20:22:25 +00:00
Jacob Kaplan-Moss c01098e9cb In urlconfs, include() may now be used on an iterable of patterns instead of just a module string. Refs #6470 -- making the admin use a urlconf is much easier with this work done. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9728 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-10 22:54:20 +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 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
Gary Wilson Jr 9af56803f5 Fixed #8245 -- Added a LOADING flag to autodiscover to prevent an admin.py module with errors from raising a spurious AlreadyRegistered exception in a subsequent call to autodiscover.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9680 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-23 18:25:24 +00:00
Karen Tracey ca33f07e2c Fixed #9865 -- Allow saving of new inline-edited objects with custom non-auto primary key fields that are not the foreign key to the parent object.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9664 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-21 04:56:32 +00:00
Karen Tracey 986e162c5d Follow-up to r9656 -- beef up the added test to exercise all (one can hope) paths through the troublesome get_deleted_objects function and fix the resulting errors.
Refs #9859.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9657 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-16 17:42:18 +00:00
Karen Tracey 10894da8a8 Fixed #9859 -- Added another missing force_unicode needed in admin when running on Python 2.3. Many thanks for report & patch to nfg.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9656 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-16 15:04:47 +00:00
Malcolm Tredinnick fddc0c589e Removed one test that is only intended for PostgreSQL from the visibility of
other databases. This basically hides an annoying warning when running the
tests under MySQL.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9649 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-16 06:42:19 +00:00
Malcolm Tredinnick b96b450981 Fixed #9786 -- Fixed inequality checking for django.db.models.fields.file.FieldFile class.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9647 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-16 04:52:55 +00:00
Malcolm Tredinnick a1cbeb9afb If an SQL query doesn't specify any ordering, avoid the implicit sort
that happens with MySQL when a "GROUP BY" clause is included. This is a
backend-specific operation, so any other databases requiring similar
encouragement can have a function added to their own backend code.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9637 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-10 05:19:27 +00:00
Malcolm Tredinnick 5570b0766d Fixed #9778 -- Added some special casing of the "Join on field 'abc'" error
message. It now gives an extra hint if there's a chance you just made a typo in
the lookup type.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9620 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-09 07:03:52 +00:00