Commit Graph

737 Commits

Author SHA1 Message Date
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
Malcolm Tredinnick 5e9c5de78a Fixed #9775 -- Fixed an oversight from r9601 and allow direct attribute
lookup in the serializable_value() method. This means that abstract
parents that are multi-table children of other models(no, really!!) now
work again.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9618 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-09 06:49:40 +00:00
Matt Boersma 15bd649940 Fixed obscure Oracle quoting issues pointed out by the custom_columns_regress test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9612 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-08 18:36:22 +00:00
Malcolm Tredinnick d662ef5540 The first step in fixing a group of problems related to outputting a proper
"value" for a field that is a relation to another model.

This part adds the utility method on Model that should help in general.Also
cleans up the slightly ugly mess from r8957.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9601 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-08 08:15:37 +00:00
Malcolm Tredinnick 33c0f0de67 This fixes a group of problems in the SQL created by QuerySet.exclude() when
used in a few situations where NULL results can appear.

Fixed #8921 (the only ticket I know of that noticed any of these).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9590 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-08 02:39:51 +00:00
Malcolm Tredinnick d4f0ae42a2 Fixed #9188 -- Fixed a case where we were generating syntactically invalid SQL in some exclude() queries.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9588 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-07 05:48:01 +00:00
Luke Plant 5ef0c03ae9 Fixed #8248: made help() work on models and improved introspection support.
Descriptors now return themselves when accessed via the class, as per standard
Python descriptors like property().



git-svn-id: http://code.djangoproject.com/svn/django/trunk@9550 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-02 22:09:51 +00:00
Ian Kelly 4637a77ff8 Fixed #9706: made SlugField honor max_length in Oracle, matching the other backends.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9548 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-02 18:40:40 +00:00
Ian Kelly 485316017a Fixed a pair of bugs in determining the set of models to flush that were causing test cause failures in Oracle after [9536].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9546 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-02 16:58:06 +00:00
Russell Keith-Magee 5834b1837f Fixed #9736 -- Added quoting to the SQL constraint names generated during table creation. This is to accommodate primary keys with spaces.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9543 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-02 13:23:29 +00:00
Karen Tracey 8e350d036c Fixed #9608: Ensured a Model's default repr() is printable even if its __unicode__ method raises a Unicode error.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9475 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-16 18:58:43 +00:00
Malcolm Tredinnick 1418da7ee4 Fixed #6052 -- Worked around a bug in MySQLdb with regards to handling
SafeUnicode (handle SafeString similarly, just to be safe). Based on a patch
from sfllaw.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9467 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-16 08:50:06 +00:00
Malcolm Tredinnick 9d0bacebd2 Fixed #3501 -- Fixed date filtering in querysets for nullable date fields. Only
affects SQLite.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9466 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-16 08:48:24 +00:00
Ian Kelly 43b03ba57d Refs #9408: Removed support for passing params as dicts in the oracle backend. Wasn't documented, didn't work, isn't necessary.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9418 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-14 00:54:16 +00:00
Karen Tracey cb6a5886f6 Fixed #5079 -- Avoid converting Decimals to floats during save to the database.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9394 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-12 00:35:24 +00:00
Malcolm Tredinnick 3dfbaae32b Fixed #9307 -- Added the ability to pickle the Query class used by the Oracle
backend.

This allows Querysets to be cached for Oracle and should provide a model for
adding pickling support to other (external) database backends that need a
custom Query class.

Thanks to Justin Bronn for some assistance with this patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9272 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-24 09:36:22 +00:00
Malcolm Tredinnick 9319dc496c Fixed #9406 -- Ensure that each database column is only represented once in the
"ORDER BY" clause of an SQL statement.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9251 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-24 06:09:47 +00:00
Ian Kelly 934025e58d Fixed #9136: Do slicing in Oracle with rownum instead of row_number() for a speed improvement. Thanks, Guillaume Taglang.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9235 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-18 00:00:20 +00:00
Ian Kelly 51d101b573 Fixed Oracle introspection mapping of DATE columns, and added an entry for Oracle 10g native float columns.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9231 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-13 19:38:18 +00:00
Ian Kelly 9a72913edd Fixed .distinct() not working with slicing in Oracle, due to the
row numbers necessarily being distinct.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9221 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-10 17:15:58 +00:00
Malcolm Tredinnick 559aca7d78 A queryset that has had ordering removed (order_by()) can have ordering added
again later (order_by('foo')). Or, at least, it can now. Thanks to Ilya
Novoselov for diagnosing the problem here.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9206 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-08 09:45:27 +00:00
Malcolm Tredinnick 44f228fd61 Fixed #6748 -- When printing the repr() of querysets, don't load or display
more than 20 objects.

This means that accidentally executing HugeStoryArchive.objects.all() at the
interactive prompt (or in the debug template) won't try to load all 4,233,010
stories into memory and print them out. That would previously cause resource
starvation and other "interesting" crashes.

If you really, really want the previous behaviour (e.g. in a doctest that
prints more than 20 items), display "list(qs)" instead of just "qs".


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9202 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-08 08:38:33 +00:00
Malcolm Tredinnick 268ef594ac Applying a limit to a queryset that already had an upper limit of 0 wasn't
working properly.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9201 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-08 08:37:35 +00:00
Malcolm Tredinnick 40904d0404 Fixed #9068 -- Fixed a couple of typos in InsertQuery.clone(). Thanks, rush.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9150 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-05 11:55:52 +00:00
Malcolm Tredinnick baa960209f Fixed Queryset.dates() in the presence of extra-select columns.
Any extra(select=...) columns can be ignored in the SQL for dates, since we are
only interested in extracting distinct date values. We were previously
including them by accident and it was generating incorrect SQL.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-28 04:36:10 +00:00
Malcolm Tredinnick 922aba3def Fixed a missing variable initialisation deep in the Query bowels.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9081 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-22 00:31:22 +00:00
Malcolm Tredinnick e99cd48769 Fixed #9113 -- Improved exception message reporting when importing sqlite3 fails.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9060 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-17 07:23:17 +00:00
Malcolm Tredinnick cfcfc456e9 Fixed a typo so that cloning UpdateQuery objects won't fail mysteriously.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9008 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-11 02:02:06 +00:00
Malcolm Tredinnick e47cc781d8 A bug from queryset-refactor days: although the Query class has "group_by" and
"having" attributes, only the former was included in the resulting SQL, meaning
subclasses had to completely duplicate Query.as_sql() if they were using any
kind of grouping filtering on the results.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9007 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-11 02:00:27 +00:00
Ian Kelly 0cd7fbec56 Fixed an incorrectly named DatabaseOperations method. It was causing non-Oracle backends to fail when running syncdb with tablespaces set.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9004 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-10 23:03:07 +00:00
Adrian Holovaty 42a878cfea db: Gave each DatabaseClient class an 'executable_name' attribute (e.g., 'psql' or 'mysql'), so that we can use it to make a more helpful error message. Refs #8978
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8989 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-09 02:13:58 +00:00
Matt Boersma 1b39622327 Fixed re-raising of ORA-01400 as an IntegrityError in a way that works on Python 2.3 and 2.4 as well.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8965 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-04 16:41:59 +00:00
Malcolm Tredinnick d88688014f Fixed #7588 -- Inherit fields from concrete ancestor classes via abstract base
classes. Based on a patch from emulbreh.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8932 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-03 18:38:43 +00:00
Malcolm Tredinnick 780f239fa7 Fixed #8825 -- Fixed a small error model field setup (on the model class) from
r8855. Patch from Christofer Bernander. Test based on one from cgrady.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8908 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-03 05:53:50 +00:00
Malcolm Tredinnick 61cc4a1eee Fixed #8819 -- Don't include two copies of extra-select columns in the query.
This was triggered by r8794, but was, in fact, fairly fragile before then. The
current fix is the correct way we should be doing this.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8898 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-03 03:48:25 +00:00
Malcolm Tredinnick 85ebb91846 Fixed #8669 -- Use a consistent version of create() across the board for
model/field instance creation. Based on a patch from Richard Davies.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8884 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-03 00:09:33 +00:00
Jacob Kaplan-Moss 79d2ee3b6d Fixed #8309: subclasses now inherit `GenericForeignKey` correctly. There's also now an internal API so that other "virtual fields" like GFK can be inherited as well. Thanks, msaelices.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8855 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-02 15:26:00 +00:00
Malcolm Tredinnick 5c32fe7fad Fixed #8790 -- Multi-branch join trees that shared tables of the same name were
sometimes also sharing aliases, instead of creating their own. This was
generating incorrect SQL.

No representative test for this fix yet because I haven't had time to write one
that fits in nicely with the test suite. But it works for the monstrous example
in #8790 and a bunch of other complex examples I've created locally. Will write
a test later.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8853 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-02 13:52:07 +00:00
Malcolm Tredinnick f31425e8e2 Fixed #7154 -- Inherit all model managers from abstract base classes.
Also added documentation describing how manager inheritance works (and when
manager aren't inherited). Based on some patches from sebastian_noack and
emulbreh.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8851 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-02 09:04:54 +00:00
Malcolm Tredinnick 12f6259903 Fixed #8439 -- Complex combinations of Q-objects (using both conjunctions and
disjunctions) were producing incorrect SQL when nullable relations were
involved. This fixes that.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8832 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-02 02:16:41 +00:00
Malcolm Tredinnick 3cdfb47e93 A typo fix that fortunately wasn't creating invalid SQL, just slightly less
efficient than possible SQL in some odd cases (found via code inspection, not
any particular failing example).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8831 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-02 00:50:19 +00:00
Malcolm Tredinnick 1b615ac46d Get the join promotion code (a bit more) correct when constructing joins for ordering.
Yes, this really is a commit that fixes an oversight in a commit that fixed an
oversight. One day I'll get it right.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8829 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-02 00:20:10 +00:00
Ian Kelly 6211527fa2 Replaced exact lookups of the empty string with isnull lookups in Oracle. Fixes the testPreventDuplicateComments case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8827 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 23:18:42 +00:00
Brian Rosner ce47d4ab83 Fixed #8648 -- Admin no longer ignores to_field. Thanks for the help Karen Tracey and SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8823 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 22:43:38 +00:00
Jacob Kaplan-Moss 3a18002bbd Fixed #8210 and #8664: moved `USStateField` and `PhoneNumberField` to `django.contrib.localflavor.us`. This is a backwards-incompatible change, albeit a minor one; just add an aditional `import` and go on your way.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8819 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 22:15:35 +00:00
Brian Rosner 7c7ad041b3 Fixed #7975 -- Callable defaults in inline model formsets now work correctly. Based on patch from msaelices. Thanks for your hard work msaelices.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8816 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 21:28:32 +00:00
Jacob Kaplan-Moss d5cc16b471 Fixed #8076: fixed `get_(next/previous)_by_date` when used with subclasses. Thanks, bjornkri and jan_oberst.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8814 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 21:04:01 +00:00
Ian Kelly d2f420ec8a Corrected Oracle DatabaseError definition.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8810 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 19:58:41 +00:00
Ian Kelly c887d71e76 Fixed escaping of wildcard characters in iexact lookups in Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8808 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 19:37:48 +00:00
Jacob Kaplan-Moss 7ecdf47bd0 Fixed #8115: avoid a infiniate loop when collecting related objects for deletion.
I can't reproduce the original error leading to #8115 and the patch. However, the only harm this change could cause is to raise more `CyclicDependency` exceptions than strictly necessary. That's better than infinite loops, at least, and it's easier to clean up in the future when we figure out the actual fix.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8807 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 19:35:03 +00:00
Jacob Kaplan-Moss d7e9bb0571 Repaired an oversight from [8772] that let made certain types of fields with choices fail. Fixes #6967 again.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8806 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 19:20:03 +00:00
Ian Kelly 5f31e9bd33 Fixed extra_select with DateQuery in Oracle
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8804 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 18:45:49 +00:00
Jacob Kaplan-Moss e545058ba9 Fixed #8354: the MySQL backend no longer raises a cryptic error. Instead, it raises a less-cryptic error. Obiously this isn't a perfect solution by any means, but it'll do until we can revisit timezone handling in the future.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8802 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 17:48:39 +00:00
Russell Keith-Magee f55b834c2f Fixed #7302: Corrected quoting of columns in extra_group_by. Thanks to Ivan Sagalaev for the patch and initial test.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8794 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 12:07:26 +00:00
Malcolm Tredinnick 2d7feda05c Fixed #7512 -- Fixed an oversight when I first fixed ordering on nullable
foreign keys (r7761). Thanks to George Vilches for the test case here.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8783 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 02:43:55 +00:00
Malcolm Tredinnick 4480645ac3 Fixed #8316 -- Put tighter restrictions on the type of Foreign Key fields
created for MySQL (because MySQL + InnoDB has those restrictions).
Patch from julianb.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8782 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-01 00:49:03 +00:00
Jacob Kaplan-Moss 3b63953704 Fixed #6967: `ModelForm`s now validate choices. Thanks, mattmcc -- the failing test helped quite a bit.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8772 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-31 20:11:11 +00:00
Brian Rosner 27f9b96fa0 Fixed handling of primary keys in model formsets. Model formsets should now work nicely with custom primary keys that are OneToOneField, ForeignKey and AutoField. Added tests to handle each of them.
Fixes #8241, #8694, #8695 and #8719.

Thanks Karen Tracey, jonloyens, sciyoshi, semenov and magneto for tracking down various parts of this patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8756 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-31 09:49:55 +00:00
Malcolm Tredinnick fd0cc45828 [8721] introduced some internal field names. We hide them from the list of
valid field names in debugging output so that it doesn't confuse things.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8730 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-30 04:52:56 +00:00
Malcolm Tredinnick 51836756d0 Fixed a typo from the refactoring in [8455]. With bonus test, too. Thanks, vung.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8724 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-29 22:29:38 +00:00
Malcolm Tredinnick 38362a1276 Fixed a missing piece of [8721].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8723 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-29 21:48:40 +00:00
Malcolm Tredinnick f04123f4df Fixed #8279 -- Multiple many-to-many relations to "self" are now possible.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8721 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-29 21:24:00 +00:00
Malcolm Tredinnick 90279aeaf0 Fixed #8575 -- Catch one particular instance of OperationalError in MySQL and
convert it to an IntegrityError, which seems like the more natural case (and is
consistent with other backends). This makes exception handling in Django much
easier.

The solution is extensible for any other error codes we may wish to add going
forwards.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8692 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-29 04:30:07 +00:00
Malcolm Tredinnick 54f41e3507 Fixed #8101 -- Allow the strings '1' and '0' as filter values for boolean
fields (the latter was causing problems). This allows these values in URLs
(e.g. the admin filtering).

Not an ideal solution to the problem, but will do the job for the time being.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8691 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-29 02:40:56 +00:00
Malcolm Tredinnick a1d2f6ef0c Fixed #7823 -- Fixed an edge case in RelatedField.get_db_prep_lookup() so that
it works correctly with custom field subclasses. Patch from Ivan Sagalaev.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8690 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-29 02:40:50 +00:00
Jacob Kaplan-Moss fc2978cc45 Fixed a bug in `NullBooleanField.to_python`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8684 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-28 21:23:21 +00:00
Jacob Kaplan-Moss a41ca9c9e2 Fixed #8556: added a useful formfield to `CommaSeparatedIntegerField`. gkelly, mattmcc, and kratorius all contributed portions of this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8682 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-28 20:58:10 +00:00
Malcolm Tredinnick f96b1249ce Removed a couple of unused imports.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8674 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-28 19:28:31 +00:00
Malcolm Tredinnick c181734fa1 Changed create() and get_or_create() to force an insert (not update an existing value).
Backwards incompatible if you are using manually-specific primary key values
and relying on the previously documented behaviour that the new values would
always exist in the database (i.e. it would update the existing entry).

Fixed #8419.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8670 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-28 17:18:05 +00:00
Jacob Kaplan-Moss 1a40498da4 FIxed #8613: removed vestigal `FileField.save_file()`. Thanks, kratorius.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8663 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-28 16:05:09 +00:00
Malcolm Tredinnick 21672c26bf Fixed #8592 -- Fixed a bug in the way savepoint usage was disabled for
PostgreSQL < 8.0.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8648 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-28 06:49:00 +00:00
Malcolm Tredinnick 71dda19184 Fixed #8597 -- Allow the use of strings containing underscores and percentage
signs in "iexact" queries on PostgreSQL again (this case was missed in [8536]).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8646 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-28 05:42:05 +00:00
Malcolm Tredinnick 4cd03ef5d9 Improvements to [8608] to fix an infinite loop (for exclude(generic_relation)).
Also comes with approximately 67% less stupidity in the table joins for
filtering on generic relations.

Fixed #5937, hopefully for good, this time.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8644 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-28 05:00:23 +00:00
Jacob Kaplan-Moss 52672f2b94 Fixed #8534: getting the size of a file no longer opens it (at least for the built-in file-system storage). Thanks, snaury.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8638 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-27 21:30:47 +00:00
Jacob Kaplan-Moss 8943a857a7 Fixed #8175: don't open files we're about to close. This was a pesky bug to track down; thanks to charmless for tracking it down.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8637 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-27 21:18:45 +00:00
Gary Wilson Jr c2ba59fc1d Removed oldforms, validators, and related code:
* Removed `Manipulator`, `AutomaticManipulator`, and related classes.
 * Removed oldforms specific bits from model fields:
   * Removed `validator_list` and `core` arguments from constructors.
   * Removed the methods:
     * `get_manipulator_field_names`
     * `get_manipulator_field_objs`
     * `get_manipulator_fields`
     * `get_manipulator_new_data`
     * `prepare_field_objs_and_params`
     * `get_follow`
   * Renamed `flatten_data` method to `value_to_string` for better alignment with its use by the serialization framework, which was the only remaining code using `flatten_data`.
 * Removed oldforms methods from `django.db.models.Options` class: `get_followed_related_objects`, `get_data_holders`, `get_follow`, and `has_field_type`.
 * Removed oldforms-admin specific options from `django.db.models.fields.related` classes: `num_in_admin`, `min_num_in_admin`, `max_num_in_admin`, `num_extra_on_change`, and `edit_inline`.
 * Serialization framework
   * `Serializer.get_string_value` now calls the model fields' renamed `value_to_string` methods.
   * Removed a special-casing of `models.DateTimeField` in `core.serializers.base.Serializer.get_string_value` that's handled by `django.db.models.fields.DateTimeField.value_to_string`.
 * Removed `django.core.validators`:
   * Moved `ValidationError` exception to `django.core.exceptions`.
   * For the couple places that were using validators, brought over the necessary code to maintain the same functionality.
 * Introduced a SlugField form field for validation and to compliment the SlugField model field (refs #8040).
 * Removed an oldforms-style model creation hack (refs #2160).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8616 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-27 07:19:44 +00:00
Malcolm Tredinnick d70c8907cd Fixed #5937 -- When filtering on generic relations, restrict the target objects to those with the right content type.
This isn't a complete solution to this class of problem, but it will do for
1.0, which only has generic relations as a multicolumn type. A more general
multicolumn solution will be available after that release.


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


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8598 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-26 20:44:20 +00:00
Malcolm Tredinnick 4f711eb5e3 Fixed #8347 -- Added a few missing field type conversion to SQLite's inspectdb
handling. Patch from trbs.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8580 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-26 08:58:07 +00:00
Gary Wilson Jr b016ea0ace Removed trailing whitespace in a few files.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8571 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-26 04:55:56 +00:00
Malcolm Tredinnick 3deff41a32 Fixed #8106 -- Untangled some problems with complex select_related() queries
and models that have multiple paths to them from other models.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8559 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25 22:43:25 +00:00
Matt Boersma 1aa4889808 Fixed get_or_create test case for Oracle by re-raising the more specific IntegrityError for "ORA-01400: Cannot insert NULL into [table.col]"
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8545 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25 17:20:28 +00:00
Jacob Kaplan-Moss 3df7266056 Fixed #3575: use UPPER() instead ILIKE for postgres case-insensitive comparisons.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8536 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25 12:56:06 +00:00
Malcolm Tredinnick 29d2160213 Fixed #7464 -- Fixed the psycopg2 backend to handle SafeString values as
parameters. Based on a patch from Digitalxero@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8532 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25 04:13:27 +00:00
Brian Rosner 82a1d5471c Fixed #7888 -- Handle model inheritance with model formsets correctly. Thanks bpeschier for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8528 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25 03:51:25 +00:00
Malcolm Tredinnick d535edb9da Fixed #8510 -- Allow both strings (mostly for the admin) and integers to be
used in "month" and "day" filters on date/datetime fields. Without this commit,
SQLite behaved inconsistently after [8494].


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8526 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-25 03:17:06 +00:00
Matt Boersma 6b5a607606 Fixed #7628 -- Oracle backend won't try to recreate existing sequences during syncdb. Thanks, cmarshal.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8522 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-24 20:16:56 +00:00
Russell Keith-Magee 11e43883d5 Fixed #8298: Added a to_python method for integer fields. This ensures that the data from deserialized instances is of correct type prior to saving. Thanks to Andrew Badr for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8515 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-24 08:12:13 +00:00
Malcolm Tredinnick aba518f0f8 Removed a relatively pointless QuerySet clone introduced in [8472].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8499 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-23 18:34:32 +00:00
Malcolm Tredinnick 64ca36bf08 Fixed #8214 -- Added back a stringification that was dropped during [8131].
This restores filtering on dates in the admin, for example. Thanks to akfarrell
and a small team of workers at the Portland Sprint.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8494 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-23 18:01:16 +00:00
Brian Rosner 5061970b76 Fixed #8040 -- SlugField now returns a proper formfield to deal with validation. Thanks Daniel Pope for the ticket and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-23 04:59:25 +00:00
Brian Rosner 264771f1b6 Fixed #7536 -- Added NEWDECIMAL to introspection types in the mysql backend. Thanks Jerome Etienne for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8475 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-23 04:14:23 +00:00
Malcolm Tredinnick d4d7bc175d Fixed #8046 -- The first filter() call on a related manager for many-to-many
fields no longer creates duplicate copies of the join table(s). Basically, this
means filters on the join table (for ManyToManyField(through=...)) and complex
filters in the normal (non-through) case don't produce incorrect or duplicate
results.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8472 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-22 22:00:28 +00:00
Matt Boersma 6e36ce1429 Fixed Oracle backend limit/offset SQL to again use extra_select, properly this time. This cleans up a test case failure, and hopefully gets contrib.gis working again.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8471 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-22 20:26:20 +00:00
Brian Rosner 1b8b9686fa Fixed #7947 -- Handle the display of OneToOneField in model forms correctly. Thanks tyson for the report and original patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8469 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-22 19:27:26 +00:00
Russell Keith-Magee 0d3dd8b68b Fixed #8485: Reordered imports in the database backends to ensure that the availability of the MySQL and Oracle backends is confirmed before any attempt is made to use the backend. Many thanks to Karen Tracey for her work in narrowing down a number of vague reports into a concrete problem.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8466 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-22 14:18:53 +00:00
Malcolm Tredinnick b9407b26df Made it possible to pickle DateQuerySets.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8455 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-20 22:38:15 +00:00
Matt Boersma db76b1e89d Fixed Oracle backend not to use extra_select for limit/offset type queries, which fixes a majority of the currently failing tests. Thanks, Ramiro Morales.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8445 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-19 23:04:34 +00:00
Russell Keith-Magee f748fa2762 Fixed #7908: Added validation checks on attempts to create ForeignKey and M2M relations with abstract classes. Thanks to Rock Howard for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8442 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-19 14:17:24 +00:00
Malcolm Tredinnick 556fbc78a6 Fixed #8039 -- Make sure that extra(tables=...) tables are always included in
the resulting SQL. Previously, an optimisation was removing them in some corner
cases.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8429 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-17 22:38:36 +00:00
Malcolm Tredinnick 2c4b13cbe7 Changed the (internal) way extra(select=.., select_params=...) handling is done
so that parameters stay with their select items. This means that merging and
trimming of those items is handled correctly.

Refs #7957, #7961. Fixed #8191.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8426 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-17 20:07:59 +00:00
Malcolm Tredinnick 98be841549 Fixed #8238 -- If an invalid database backend is mentioned in settings and the
environment doesn't support os.listdir(), we crashed whilst trying to construct
the friendly error message. This was not so friendly.

This patch handles that case (which occurs in real life in Google App Engine).
Patch from Guido van Rossum.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8424 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-17 17:32:31 +00:00
Malcolm Tredinnick 260510453f Fixed #7241 -- More robust exception catching in the transaction management
code. As pointed out in the ticket, Python still lets you raise all sorts of
odd things as exceptions (e.g. strings), so even though they're bad form, we
should still handle them. We do that cleanly now. Thanks to jim-django@dsdd.org
for the patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8419 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-17 00:07:06 +00:00
Gary Wilson Jr a949f9ec7d Fixed #3121 -- Made `get_or_create()` work for `RelatedManager` and `ManyRelatedManager`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8415 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-16 20:59:06 +00:00
Malcolm Tredinnick 844089de07 Fixed #8315 -- If an exception is raised whilst trying to rollback a
transaction (after another exception in the code), make sure the original
exception is reported, rather than the rollback-generated one. The latter is
almost certainly a consequence of the former. Patch from Karen Tracey.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8411 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-16 15:58:30 +00:00
Russell Keith-Magee 7299b39752 Fixed #8355: Removed some whitespace that was apparently causing difficulty with script compilation. Thanks to bear330 for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8402 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-16 04:48:57 +00:00
Gary Wilson Jr ddc156bca2 Fixed #6970 -- Raise the original `IntegrityError` when all required fields aren't specified in `get_or_create` instead of a misleading `DoesNotExist` error, thanks deadwisdom.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8398 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15 23:29:55 +00:00
Malcolm Tredinnick 93462f9516 Reverted [8318] and [8329], since the change turned out to have no effect, upon
closer examination of the C-library layer.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8380 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15 14:58:59 +00:00
Russell Keith-Magee 1691c22821 Fixed #8331 -- Added style parameter to sqlite backend implementation of sql_remove_table_constraints, missed in recent db backend refactor. Thanks to d00gs for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8364 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15 07:35:47 +00:00
Matt Boersma fcc42c1bf7 Fixed Oracle backend test case failure in modeltests\lookup.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8355 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15 01:33:18 +00:00
Gary Wilson Jr 788de6b5fd Fixed #8206 -- Removed validate methods of Model and Model fields. They are are unsupported for 1.0 and will be replaced with more complete model validation (refs #6845).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8348 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-14 15:37:43 +00:00
Matt Boersma ca020a5edd Fixed oracle-specific test DB creation code so the test suite will run again.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8330 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 18:49:44 +00:00
Malcolm Tredinnick a14f41f345 Fixed #8260 -- Changed [8318] to also work with MySQLdb 1.2.1p2.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8329 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 16:28:52 +00:00
Malcolm Tredinnick bb5a35cc54 Fixed a group of missing imports, aliases and parameter passings from the
db.backend.creation refactoring.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8328 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 16:06:55 +00:00
Malcolm Tredinnick 6294fc7179 Changed "exact" matches in MySQL to use the database's native collation.
This effectively reverses the change in [7798]. It was proving too difficult to
successfully manage all the side effects here and provide a satisfactory
solution for everybody. Many thanks to arne, Martin von Löwis and, particular,
Karen Tracey, for doing a lot of research and proto-patches here to establish what was possible and practical.

This is backwards incompatible if you were relying on the behaviour after
[7798]. The docs have been updated to indicate the solution.

Refs #2170, #7789, #8102.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8319 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 07:52:33 +00:00
Malcolm Tredinnick ca71eacdf4 Convert binary-matched VARCHAR fields to unicode objects in the MySQL backend.
This conforms to Djangos' policy of returning Unicode everywhere.

Suggested by arne and Martin von Löwis. Refs #7789.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8318 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 07:52:17 +00:00
Malcolm Tredinnick 6bebb23318 Do not use savepoints with PostgreSQL prior to 8.0.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8317 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 06:31:29 +00:00
Malcolm Tredinnick 3eb8074808 Added savepoint protection to get_or_create() to avoid problems on PostgreSQL.
Fixed #7402.

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


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8315 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 05:59:43 +00:00
Malcolm Tredinnick 220993bcc5 Added savepoint support to the transaction code.
This is a no-op for most databases. Only necessary on PostgreSQL so that we can
do things which will possibly intentionally raise an IntegrityError and not
have to rollback the entire transaction. Not supported for PostgreSQL versions
prior to 8.0, so should be used sparingly in internal Django code.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8314 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 05:34:56 +00:00
Jacob Kaplan-Moss ab1a442a01 Fixed stupid syntax error in [8303].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8305 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 15:54:42 +00:00
Jacob Kaplan-Moss 5d837afe23 Fixed #8228: fixed a Python 2.3 compatibility from [8296].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8303 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 15:24:44 +00:00
Russell Keith-Magee 97fd752fe7 Removed some empty modules that are no longer required after [8296].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8301 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 14:16:09 +00:00
Russell Keith-Magee 3958c36319 Corrected a problem with the error message when the nominated database backend doesn't exist. Thanks to Ramiro Morales for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 13:11:25 +00:00
Russell Keith-Magee 9dc4ba875f Fixed #5461 -- Refactored the database backend code to use classes for the creation and introspection modules. Introduces a new validation module for DB-specific validation. This is a backwards incompatible change; see the wiki for details.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8296 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 12:11:25 +00:00
Gary Wilson Jr ef48a3e69c Fixed #7830 -- Removed all of the remaining, deprecated, non-oldforms features:
* Support for representing files as strings was removed. Use `django.core.files.base.ContentFile` instead.
 * Support for representing uploaded files as dictionaries was removed. Use `django.core.files.uploadedfile.SimpleUploadedFile` instead.
 * The `filename`, `file_name`, `file_size`, and `chuck` properties of `UploadedFile` were removed. Use the `name`, `name`, `size`, and `chunks` properties instead, respectively.
 * The `get_FIELD_filename`, `get_FIELD_url`, `get_FIELD_size`, and `save_FIELD_file` methods for Models with `FileField` fields were removed. Instead, use the `path`, `url`, and `size` attributes and `save` method on the field itself, respectively.
 * The `get_FIELD_width` and `get_FIELD_height` methods for Models with `ImageField` fields were removed. Use the `width` and `height` attributes on the field itself instead.
 * The dispatcher `connect`, `disconnect`, `send`, and `sendExact` functions were removed. Use the signal object's own `connect`, `disconnect`, `send`, and `send` methods instead, respectively.
 * The `form_for_model` and `form_for_instance` functions were removed. Use a `ModelForm` subclass instead.
 * Support for importing `django.newforms` was removed. Use `django.forms` instead.
 * Support for importing `django.utils.images` was removed. Use `django.core.files.images` instead.
 * Support for the `follow` argument in the `create_object` and `update_object` generic views was removed. Use the `django.forms` package and the new `form_class` argument instead.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8291 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-10 21:10:47 +00:00
Jacob Kaplan-Moss 049d490875 Fixed #7921: for sqlite3 2.4.1 or later, adapt str objects to unicode, thus preveting weird failures with 8-bit bytestrings. Martin von Löwis and Karen Tracey tracked this one down -- thanks!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8276 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-09 23:59:01 +00:00
Malcolm Tredinnick dc14b29fb3 Added the ability to force an SQL insert (or force an update) via a model's
save() method.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8267 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-09 17:19:23 +00:00
Jacob Kaplan-Moss 7899568e01 File storage refactoring, adding far more flexibility to Django's file handling. The new files.txt document has details of the new features.
This is a backwards-incompatible change; consult BackwardsIncompatibleChanges for details.

Fixes #3567, #3621, #4345, #5361, #5655, #7415.

Many thanks to Marty Alchin who did the vast majority of this work.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-08 20:59:02 +00:00
Malcolm Tredinnick 32d5c39016 Fixed #6523 -- Use the correct cast on field types for PostgreSQL when
searching within a field column (e.g. "like", "contains", etc). Required for
PostgreSQL 8.3. Thanks to Dan Watson for the patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8242 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-08 20:09:53 +00:00
Malcolm Tredinnick 567b9f2e28 Fixed #8111 -- Error message typo fix. Thanks mzgur.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8229 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-08 14:24:25 +00:00
Jacob Kaplan-Moss 34a3bd5225 Major refactoring of django.dispatch with an eye towards speed. The net result is that signals are up to 90% faster.
Though some attempts and backwards-compatibility were made, speed trumped compatibility. Thus, as usual, check BackwardsIncompatibleChanges for the complete list of backwards-incompatible changes.

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

Documentation is, sigh, still forthcoming.

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


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-06 15:32:46 +00:00
Jacob Kaplan-Moss 98d8acf33f Fixed #7683: Try not to delete uploaded files before moving them, and don't wig out of someone else does. Patch from screeley and spaetz.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8217 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-05 17:43:05 +00:00
Jacob Kaplan-Moss 593810a501 Fixed #7904: added support for a "use_for_related_fields" property on managers. If True, the manager will be used for related object lookups instead of the "bare" QuerySet introduced bu [8107]. Patch from Justin Bronn.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8212 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-05 16:13:28 +00:00
Gary Wilson Jr 06885f37be Removed unused warnings import that should have been removed in [8191], refs #7830.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8199 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-03 17:26:50 +00:00
Gary Wilson Jr c85c8f8891 Fixed #7919 -- md5 and sha modules are deprecated since Python 2.5, use hashlib module when available. Patch from Karen Tracey.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8193 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-02 05:56:57 +00:00
Gary Wilson Jr 351a3ca154 Removed several deprecated features for 1.0 (refs #7830):
* "simple" cache backend
 * `ObjectPaginator`
 * `edit_inline_type` argument for `ForeignKey` fields
 * `QOperator`, `QNot`, `QAnd` and `QOr`
 * `maxlength` argument 


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8191 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-02 04:56:11 +00:00
Gary Wilson Jr 2db4b13480 Fixed #8070 -- Cache related objects passed to Model init as keyword arguments. Also:
* Model init no longer performs a database query to refetch the related objects it is passed.
 * Model init now caches unsaved related objects correctly, too. (Previously, accessing the field would raise `DoesNotExist` error for `null=False` fields.)
 * Added tests for assigning `None` to `null=True` `ForeignKey` fields (refs #6886).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8185 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-01 23:16:59 +00:00
Malcolm Tredinnick b7e74e5e56 Fixed #8028 -- A couple of small docstring fixes from [8131]. Thanks, Leo Soto.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8146 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-30 03:16:39 +00:00
Malcolm Tredinnick 464a9c8ca4 Fixed #7637 -- Added an extra parameterisation hook to the Oracle backend.
Required for some extension modules (in particular, geo-django). Patch from
Justin Bronn.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8145 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-30 01:29:31 +00:00
Malcolm Tredinnick 281f2b74bf Fixed #8023 -- Allow filtering of DecimalFields (in models) using strings.
At the same time, checked all other cases of db_prep_value() to ensure they
aren't making the same mistake.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8143 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-30 00:18:49 +00:00
Russell Keith-Magee a14fc40041 Fixed #7913 -- Corrected ham-fisted typo from [8102]. Thanks to evinrik for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8139 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-29 21:43:07 +00:00
Jacob Kaplan-Moss b69b15fe02 Fixed a subtle bug (really, an inconsistency) in ForeignKey that [8132] exposed by causing the model_forms test to fail.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8138 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-29 18:31:27 +00:00
Russell Keith-Magee 174641b9b3 Fixed #6095 -- Added the ability to specify the model to use to manage a ManyToManyField. Thanks to Eric Florenzano for his excellent work on this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8136 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-29 12:41:08 +00:00
Malcolm Tredinnick af7773f280 Fixed #8011 -- Be careful not to evalute lazy-translated Meta.verbose_name
values whilst importing models.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8132 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-29 05:17:47 +00:00
Malcolm Tredinnick b3b71a0922 Fixed #7560 -- Moved a lot of the value conversion preparation for
loading/saving interactions with the databases into django.db.backend. This
helps external db backend writers and removes a bunch of database-specific
if-tests in django.db.models.fields.

Great work from Leo Soto.


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


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8128 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-28 01:32:46 +00:00
Malcolm Tredinnick 55ba38f9d2 Put back [8120] along with a small tweak. Fixed #6217.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8127 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-28 00:45:04 +00:00
Malcolm Tredinnick eca5aacec8 Back out [8120] for a bit. Refs #6217. It's having unintended side-effects (a.k.a breaks the tree)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8126 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-28 00:08:17 +00:00
Malcolm Tredinnick 6a287ed946 Fixed #6217 -- Reduced the memory used by each ugettext_lazy() call.
Thanks to Jakub Wilk for analysis and the initial patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8120 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-27 22:51:49 +00:00