Commit Graph

1027 Commits

Author SHA1 Message Date
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
Malcolm Tredinnick 2c6d1e8ebc Fixed #7886 -- Reordered some code in Query.results_iter() to ensure that all
the prequisites are correctly initialised prior to using them. Only affects
Oracle and other db backends requiring resolve_columns() (e.g. MS SQL?)


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8112 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-27 18:38:56 +00:00
Malcolm Tredinnick 4fee39c63c Fixed #7872 -- Fixed a missed case of promoting table joins when using
disjunctive filters. Thanks to Michael Radziej for the failing test case.
problem.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8107 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-27 18:16:17 +00:00
Russell Keith-Magee 661f62be3c Fixed #7913 -- Corrected backwards incompatible parts of [7977] when optgroup handling was added to field choices (Ticket #4412). Thanks to Michael Elsdorfer (miracle2k) for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8102 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-27 07:22:39 +00:00
Malcolm Tredinnick 3cbe73692e Fixed #7778 -- Fixed a tricky case of foreign key clearing with inherited
models. Patch from James Murty.


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


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8098 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-27 01:18:23 +00:00
Matt Boersma 96d141dfda Fixed Oracle backend failure in test suite for modeltests.queries. Item.objects.all()[0:0] was optimizing out the limits clause and returning all rows.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8069 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-24 20:11:37 +00:00
Malcolm Tredinnick a7b556ca04 Allow for matches against unsaved objects in querysets (which will therefore
match nothing). This allows for some more straightforward code in the admin
interface.

Fixed #7488 (all the debugging there was done by Brian Rosner, who narrowed it
down to the item in this patch).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8061 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-23 06:12:15 +00:00
Malcolm Tredinnick 8745beccb1 Fixed #7813 -- Allow pickling of Query classes that use select_related().
Based on a patch from Justin Bronn.

The test in this patch most likely breaks on Oracle. That's another issue.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8053 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-22 08:23:20 +00:00
Malcolm Tredinnick 83e97ecf88 Fixed #7791 -- Fixed a really silly error I introduced in [7926]. :-(
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8052 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-22 07:37:09 +00:00
Malcolm Tredinnick 6ef47cfe5f To ensure that a model BooleanField has an explicit value set (and since it's
not required, by default), set the default properly in the constructor.

This code can be simplified when/if we resolve the
BooleanField/NullBooleanField overlap, but the current stuff is backwards
compatible. This would previously cause SQL errors on PostgreSQL and
interesting failures in subtle ways on MySQL and SQLite.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8050 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-22 04:49:32 +00:00
Adrian Holovaty 0894ddb2bb Fixed #7848 -- Removed a bunch of code that wasn't contributing to society. Thanks, julien
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8047 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-22 03:26:25 +00:00
Adrian Holovaty 29f0e8182f Fixed #7847 -- Removed a whole bunch of unused imports from throughout the codebase. Thanks, julien
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8046 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-22 03:24:09 +00:00
Jacob Kaplan-Moss 863f4eb1d7 Fixed #6755: model inheritance now works in the admin. Thanks, sloonz and Michael Placentra.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8033 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-22 01:10:06 +00:00
Jacob Kaplan-Moss 970611827b FIxed #7666: use a bare queryset when accessing single related objects so that the related objects never become inaccessible.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8017 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-21 15:41:21 +00:00
Russell Keith-Magee d911a64ce8 Fixed #6450 -- Improved the checking of errors when creating the directories for saved files. Thanks to henry@precheur.org for the report and patch, and vung for the excellent test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8007 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-20 12:44:41 +00:00
Malcolm Tredinnick 5141b67a19 Reverted [7986].
It turns out that we need to treat filename creation/display (in
particular, the upload_to path) differently depending upon whether the value is
out of the database or provided by other code and there's no reliable way to
determine that at the moment (although some later proposed changes might alter
that). So calling get_FIELD_filename on an unsaved model with a changed file
attribute will not necessarily return the same result as after the save().

Refs #5619. Fixed #7843.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7998 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 22:26:32 +00:00
Malcolm Tredinnick a103786971 Fixed #5619 -- Return the same path in get_FOO_filename() before and after a
model is saved (i.e. make sure the upload prefix is prepended in both cases).

Patch from wreese@gmail.com. Tests from Leah Culver.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7986 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 18:35:11 +00:00
Russell Keith-Magee 649463dd34 Fixed #4412 -- Added support for optgroups, both in the model when defining choices, and in the form field and widgets when the optgroups are displayed. Thanks to Matt McClanahan <cardinal@dodds.net>, Tai Lee <real.human@mrmachine.net> and SmileyChris for their contributions at various stages in the life of this ticket.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7977 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 07:53:02 +00:00
Jacob Kaplan-Moss 46786b4193 Fixed #7741: django.newforms is now django.forms. This is obviously a backwards-incompatible change. There's a warning upon import of django.newforms itself, but deeper imports will raise errors.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7971 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 01:22:26 +00:00
Brian Rosner a19ed8aea3 Merged the newforms-admin branch into trunk.
This is a backward incompatible change. The admin contrib app has been
refactored. The newforms module has several improvements including FormSets
and Media definitions.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-18 23:54:34 +00:00
Malcolm Tredinnick 436ef181f3 Fixed #5552 -- Raise an error, rather than failing silently, when DATABASE_NAME
is not specified for SQLite.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7956 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-18 22:36:31 +00:00
Adrian Holovaty 13643a7f5d Fixed #7816 -- Fixed error in a few DeprecationWarnings. Thanks, leahculver
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7955 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-18 21:45:25 +00:00
Malcolm Tredinnick c681f4070c Removed the mysql_old backend. It smells bad and has no friends.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7949 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-18 17:38:53 +00:00
Adrian Holovaty d261c1d000 Fixed #7805 -- Removed ImageField.get_internal_type() because it doesn't offer anything beyond FileField's implementation. Thanks, Gulopine
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7947 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-18 04:34:47 +00:00
Adrian Holovaty df2b19cc17 Fixed #1443 -- Django's various bits now support dates before 1900. Thanks to SmileyChris, Chris Green, Fredrik Lundh and others for patches and design help
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7946 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-18 03:47:27 +00:00
Malcolm Tredinnick 52fdedba48 Fixed #7759 -- Fixed QuerySet.count() when the results cache was only partially
populated.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7938 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-16 23:17:29 +00:00
Malcolm Tredinnick 3b37c8151a Fixed #7411 -- worked around some possible transaction conflicts in SQLite.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7926 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-15 18:47:32 +00:00
Gary Wilson Jr dee7de0c23 Re-organized imports, removing a couple that were unused.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7912 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-13 01:22:31 +00:00
Gary Wilson Jr 1bb8809561 Added a docstring to CyclicDependency exception class.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7911 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-13 01:17:23 +00:00
Malcolm Tredinnick e47d8e7fb1 Fixed #7734 -- Fixed a Python 2.3 compatibility problem.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7910 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-12 23:25:22 +00:00
Jacob Kaplan-Moss 5f73e2c4fa Fixed #7667: fixied FileField.save_file for inline related objects. This is really just papering over a bigger problem that should get fixed either by newforms-admin or the file-storage refactoring, but this fix makes the admin work until either of those things happen. Thanks, oggy.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7906 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-12 20:43:28 +00:00
Malcolm Tredinnick 52d985fac3 Fixed a bozo bug from [7885]. Fixed #7698.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7901 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-12 11:01:57 +00:00
Malcolm Tredinnick c742afb3b2 Removed a FIXME that isn't really a problem any longer.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7886 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-11 12:44:04 +00:00
Malcolm Tredinnick 2b193f6100 Fixed #7698 -- Handle '0' correctly when used as the upper bound of a slice.
Based on a patch from enoksrd.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7885 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-11 12:43:27 +00:00
Malcolm Tredinnick 7936c0b917 Fixed #7448 -- Convert "in" filters to pass in the correct values for datetimes
and similar complex objects.

Based on patches from cgrady and alexkosholev. Refs #7707.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7883 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-11 09:00:35 +00:00
Malcolm Tredinnick 1e00458521 Fixed #7682 -- Added a work around to keep existing admin alive until
newforms-admin merges (to handle changes in [7790]).

This code becomes irrelevant in a non-oldforms world, so even if it's not quite
correct, it will do for now. Based on a patch from puyb@puyb.net and Karen
Tracey.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7882 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-11 07:34:11 +00:00
Gary Wilson Jr 96a47da015 Fixed a couple typos as well as several minor style issues.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7871 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-08 21:53:38 +00:00
Jacob Kaplan-Moss a28b75b0ba Fixed #7614: the quickening has come, and there now is only one UploadedFile. On top of that, UploadedFile's interface has been improved:
* The API now more closely matches a proper file API. This unfortunately means a few backwards-incompatible renamings; see BackwardsIncompatibleChanges. This refs #7593.
  * While we were at it, renamed chunk() to chunks() to clarify that it's an iterator.
  * Temporary uploaded files now property use the tempfile library behind the scenes which should ensure better cleanup of tempfiles (refs #7593 again).

Thanks to Mike Axiak for the bulk of this patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7859 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-07 23:16:00 +00:00
Malcolm Tredinnick 6048389391 Fixed #7532 -- Removed some dead code from the db backends. Thanks, Ramiro.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7852 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-06 14:26:37 +00:00
Malcolm Tredinnick 0d0cbfd56e Fixed #7621 -- Enable superclassing of the various metaclasses we use.
Also tidy up some initialisation code in django.db.models.base.ModelBase.
Thanks, Christian Tanzer.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7846 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-06 11:55:30 +00:00
Malcolm Tredinnick 6dd2b5468f Redo the changes in [7773] in a better way.
This removes some of the leaky abstraction problems (lifting WhereNode
internals into the Query class) from that commit and makes it possible for
extensions to WhereNode to have access to the field instances. It's also
backwards-compatible with pre-[7773] code, which is also better.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7835 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-04 06:42:58 +00:00
Ian Kelly 3b6487130a Fixed #7407 -- in Oracle, made sure table names are properly quoted when resetting sequences. Thanks, erny.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7833 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-03 19:21:54 +00:00
Ian Kelly ee837ad46a Refs #7565. Fixed Oracle sequence resetting on child models.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7831 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-03 18:42:47 +00:00
Jacob Kaplan-Moss d725cc9734 Fixed #2070: refactored Django's file upload capabilities.
A description of the new features can be found in the new [http://www.djangoproject.com/documentation/upload_handing/ upload handling documentation]; the executive summary is that Django will now happily handle uploads of large files without issues.

This changes the representation of uploaded files from dictionaries to bona fide objects; see BackwardsIncompatibleChanges for details.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7814 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-01 15:10:51 +00:00
Malcolm Tredinnick 4fd359253d Modified [7760] to not include a "col is not NULL" fragment for non-nullable fields.
This avoids any use of "pk is not NULL" fragment, which behave inconsistently
in MySQL. Thanks to Russell Keith-Magee for diagnosing the problem and
suggesting the easy fix.

Refs #7076.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7812 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-01 10:12:50 +00:00
Malcolm Tredinnick 52b6857f93 Fixed #6928 -- Added a little more robustness to transaction rollbacks for Python 2.5. Patch from guettli.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7802 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-30 11:56:52 +00:00
Malcolm Tredinnick 8e816c8304 Fixed #2170 -- "exact" lookups in MySQL are now case-sensitive (the same as other backends).
This is a backwards incompatible change if you were relying on 'exact' being
case-insensitive. For that, you should be using 'iexact'.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7798 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-30 10:25:35 +00:00
Malcolm Tredinnick 52cc11c4e2 Fixed #4485 -- Allow nullable DecimalFields to store NULLs.
Based on a patch from tdterry. Thanks.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7797 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-30 10:07:06 +00:00
Malcolm Tredinnick 1a2005dfed Fixed #7156 -- Normalise file paths before returning them in models.
This avoids problems with a database that was created on Unix being used on
Windows and giving interesting results. Patch from fcaprioli@alice.it.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7795 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-30 07:17:18 +00:00
Malcolm Tredinnick 44ca5f46c9 Fixed #7033 -- Removed an unused field.
OrderingField was added in the magic-removal branch to support something that
never ultimately materialised, but it wasn't removed. So this is
backwards-incompatible if you're using this field that has no purpose, I guess.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7794 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-30 07:10:03 +00:00
Malcolm Tredinnick 5da47e43c7 Fixed #7314 -- Changed the way extra() bits are handled when QuerySets are merged.
Also added a section to the documentation to indicate why it's probably not a
good idea to rely on this feature for complex stuff. Garbage in, garbage out
applies even to Django code.

Thanks to erik for the test case for this one.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7791 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-30 06:24:21 +00:00
Malcolm Tredinnick f9df4d1435 Make sure we only create the minimum number of table indexes for MySQL.
This patch simplifies a bunch of code for all backends and removes some
duplicate index creation for MySQL, in particular (versions 4.x and later).
Patch from Nis Jørgensen.

Fixed #5671, #5680, #7170, #7186.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7790 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-30 04:46:59 +00:00
Malcolm Tredinnick b0bc8b9dfd Fixed #7565 -- Fixed a problem with PostgreSQL sequence resetting in loaddata.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7789 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-30 00:38:14 +00:00
Malcolm Tredinnick f62e5a1fba A way better fix for the count() issue in [7787].
The first attempt was brain-damaged. Let's never speak of it again.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7788 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-29 23:47:31 +00:00
Malcolm Tredinnick 18d89cc1f7 Fixed #7323 -- Fixed a count() edge-case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7787 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-29 11:50:04 +00:00
Malcolm Tredinnick 050d0a1b75 Fixed #7371 -- Fixed an edge case when ordering on related models.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7786 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-29 11:15:48 +00:00
Malcolm Tredinnick c17e326585 Fixed #7378 -- Use the "to_field" where appropriate on reverse relations.
Patch from mturtle@gmail.com. The remaining uses of "%s__pk" in
fields/related.py all look safe, since they are for many-to-many fields, which
doesn't take "to_field" as a parameter.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7785 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-29 10:35:35 +00:00
Malcolm Tredinnick 4931639636 Fixed #7276 -- Delete multi-table objects correctly.
When model inheritance is used, the parent objects should be deleted as part of
the delete() call on the child.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7784 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-29 09:41:35 +00:00
Malcolm Tredinnick 5326cd293e Factored out a semi-complex if-test that was used in two places.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7782 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-29 09:40:17 +00:00
Malcolm Tredinnick a8fa3fd81f Fixed #7246 -- Pull in the all the necessary data when using select_related() with multi-table inheritance.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7781 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-29 09:39:32 +00:00
Malcolm Tredinnick bb2182453b Fixed handling of multiple fields in a model pointing to the same related model.
Thanks to ElliotM, mk and oyvind for some excellent test cases for this. Fixed #7110, #7125.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7778 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-29 02:36:18 +00:00
Malcolm Tredinnick d800c0b031 Moved the settings of db_table to Options.contribute_to_class().
Some fields need to know the right db_table setting in their own
contribute_to_class(), so waiting until Options._prepare() is a little
inconvenient. This is a deep-internals change. No effect on external code.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7777 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-29 02:35:08 +00:00
Malcolm Tredinnick 8aec66f144 Removed a dead line that was left in [7773] by accident.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7774 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-27 03:48:11 +00:00
Malcolm Tredinnick ade4a1246c Reorganised the internals of the Where node a bit to fix some copying problems.
We no longer store any reference to Django field instances or models in the
Where node. This should improve cloning speed, fix some pickling difficulties,
reduce memory usage and remove some infinite loop possibilities in odd cases.
Slightly backwards incompatible if you're writing custom filters. See the
BackwardsIncompatibleChanges wiki page for details.

Fixed #7128, #7204, #7506.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7773 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-27 03:27:20 +00:00
Ian Kelly c237ef625c Fixed a "column" instance that wis massed in [7743].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7772 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 17:44:54 +00:00
Malcolm Tredinnick 36cb438373 Fixed #7312 -- Fixed handling of custom Q-like objects in QuerySet.custom_filter().
This is pretty much internal-use-only code, so doesn't affect public API at
all, but it's nice to be able to handle things properly in any case. Patch from
emulbreh.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7766 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 13:25:59 +00:00
Malcolm Tredinnick 9e23c3c5d9 EmptyQuerySet classes can now be merged with normal querysets.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7765 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 11:42:12 +00:00
Malcolm Tredinnick 0e692fda9c Fixed the way symmetrical many-to-many relations are recorded in the Options class.
These types of relations don't have reverse accessor names, so that name can be
used by a normal field on the model. Fixed #7107.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7764 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 10:50:25 +00:00
Malcolm Tredinnick 279fc8599b Fixed #7105 -- Fixed dates() queries in light of model inheritance.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7763 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 07:51:19 +00:00
Malcolm Tredinnick d2ce1df08f Fixed #7215 -- Create correct reverse-relation accessors when using abstract base classes. Patch from Joel Watts.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7762 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 07:04:18 +00:00
Malcolm Tredinnick ba015e0a79 Fixed #7181 -- when ordering by a potentially NULL field, use a left-outer join
so that the ordering doesn't accidentally restrict the result set.

(Ironically, one existing test actually showed this problem, but I was too
dumb to notice the result was incorrect.)


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7761 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 06:50:22 +00:00
Malcolm Tredinnick e41df5adcc Fixed #7076 -- Include NULL values when excluding non-NULL items.
Based on a patch from emulbreh.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7760 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 05:34:26 +00:00
Adrian Holovaty 2b926d4222 Fixed #7319 -- Removed unused DatabaseFeatures attribute 'needs_upper_for_iops'. Thanks, leosoto
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7747 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 04:05:48 +00:00
Malcolm Tredinnick 915001ad0b Fixed #7109 -- Quote certain values before passing them for substitution in
Field.db_type().

This fixes a problem with using reserved words for field names in Oracle. Only
affects Oracle at the moment, but the same changes could easily be used by
other backends if they are required (requires changing creation.py, only).

This commit also reverts [7501] so that if the fix doesn't work, it will show
up in the tests (and if it does work, the tests will prevent us from breaking
it again).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7743 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 03:11:32 +00:00
Malcolm Tredinnick 002dbd16b4 Removed the bulk of the sanity checking when merging QuerySets.
It was causing too many inconvenient and unintended problems when merging
legitimate subclasses (e.g. with geo-django classes). There's still a hook
there that we use when merging ValueQuerySets, but if you try to merge two
disparate QuerySets and it breaks all that happens is you get to keep both
pieces. We're no longer penalising the useful usages just for the people who
aren't concentrating.

Fixed #7113.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7742 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 02:20:45 +00:00
Malcolm Tredinnick 588eeb356c Fixed a problem when constructing complex select_related() calls.
Avoids joining with the wrong tables when connecting select_related() tables to
the main query. This also leads to slightly more efficient (meaning less tables
are joined) SQL queries in some other cases, too. Some unnecessary tables are
now trimmed that were not previously.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7741 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 01:02:11 +00:00
Malcolm Tredinnick 1834428648 Fixed a problem with values() and values_list() queries and nullable joins.
Previously, if we were querying across a nullable join and then a non-nullable
one, the second join would not be a LEFT OUTER join, which would exclude
certain valid results from the result set.

This is the same problem as [7597] but for values() field specifications, so
this covers the second case where Django adds extra stuff to the select-clause.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7740 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-26 01:01:21 +00:00
Russell Keith-Magee b8f7b39ccc Fixed #7155 -- Corrected DateQuerySet to handle nullable fields. Thanks to fcaprioli@alice.it for the original report and patch, and to Jeremy Dunck for the test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7739 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-25 13:38:06 +00:00
Luke Plant b1851cca3e Fixed bug with Model.delete() which did not always delete objects in the right order.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7722 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-21 20:57:05 +00:00
Luke Plant 7c621535a2 Added tests for corner case with deleting where objects are deleted in the wrong order.
These tests currently fail, by design, fix will be committed shortly.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7721 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-21 20:55:17 +00:00
Luke Plant 17bc2820bb Removed some unnecessary work in Model._collect_sub_objects()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7720 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-21 16:37:44 +00:00
Russell Keith-Magee e829e9ff8f Fixed #7044 -- Corrected a minor typo in a docstring in the model loader. Thanks, msaelices.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7679 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-17 13:58:19 +00:00
Adrian Holovaty 06315375ce Fixed #7420 -- Abstracted some more database options into DatabaseFeatures -- supports_usecs, time_field_needs_date, interprets_empty_strings_as_nulls and date_field_supports_time_value -- and changed various hard-coded 'if DATABASE_BACKEND == oracle' statements to use the new options. Thanks to ramiro for the patch
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7643 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-16 03:15:04 +00:00
Russell Keith-Magee 57311b5998 Fixed #7256 -- Corrected queryset code to return the correct set of columns when the query has an empty values() clause as well as extra selects from an extra() clause. Thanks to Nicolas Lara for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7636 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-15 06:24:41 +00:00
Gary Wilson Jr 0b8fafc7f1 Fixed #7387 - Fixed circular import problem when importing `contrib.contenttypes.generic` module.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7635 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-15 04:49:29 +00:00
Adrian Holovaty ac5b9f5857 Fixed #7427 -- Fixed docstring that was rendered incorrect due to qs-rf. Thanks, ramiro
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7624 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-12 04:23:14 +00:00
Adrian Holovaty 5309e18cbf Fixed #7026 -- Fixed misleading/incorrect exception text when adding to a many-to-many set on an object that doesn't yet have a primary-key value. Thanks for the report, ryan@peaceworks.ca
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7622 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-12 04:13:16 +00:00
Adrian Holovaty a08b2dd328 Negligible comment typo fixes
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7620 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-12 03:37:13 +00:00
Jacob Kaplan-Moss b5f92938ab Fixed #7298: prevent update() on sliced QuerySet since UPDATE doesn't reliably support LIMIT/OFFSET. Thanks, George Vilches.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7601 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-09 16:17:54 +00:00
Russell Keith-Magee 12716794db Fixed #7350, #7202 -- Fixed serialization for multi-model inheritance, which had multiple problems:
* Serializers were including all superclass fields in their output. Now only local fields are included.
 * Implicit OneToOne primary keys were not correctly added to the metamodel, so they were always marked to be serialized, even though they were primary
 * Model saving was too aggressive about creating new parent class instances during deserialization. Raw save on a model now skips saving of the parent class.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7600 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-09 14:03:35 +00:00
Jacob Kaplan-Moss 31d9dc07aa Fixed #7369: fixed a corner-case involving select_related() following non-null FKs after null ones. Thanks, George Vilches
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7597 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-08 18:13:46 +00:00
Jacob Kaplan-Moss 50de13343b Fixed #7342: Ignore any Meta options starting with '_', thus making it OK for Meta to be a newstyle class. Thanks, Gulopine.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7585 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-07 20:01:18 +00:00
Jacob Kaplan-Moss 1452d46240 Fixed #6886: Tightened up ForeignKey and OneToOne field assignment. Specifically:
* Raise a ValueError if you try to assign the wrong type of object.
  * Raise a ValueError if you try to assign None to a field not specified with null=True.
  * Cache the set value at set time instead of just at lookup time.

This is a slightly backwards-incompatible change; see BackwardsIncompatibleChanges for more details.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7574 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-05 00:39:32 +00:00
Russell Keith-Magee 5837a45bd9 Fixed #7173 -- Corrected the caching of objects in reverse OneToOne relationships. Thanks, Travis Terry.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7561 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-29 12:17:03 +00:00
Russell Keith-Magee 8a0b8d93b2 Fixed #7286 -- Added functools wrapping to the transaction decorators. Thanks, SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7558 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-29 11:50:50 +00:00
Russell Keith-Magee b2b7a0c1cc Fixed #7306 -- Added missing import. Thanks, SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7556 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-29 11:41:46 +00:00
Gary Wilson Jr d78e61e8bb Fixed #7212 -- Added `alters_data` attribute to `Model.save_base` method, thanks Gulopine.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7526 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-13 14:56:47 +00:00
Ian Kelly 3c4d353016 Cleaned up some comments in the Oracle backend. Fixes #7139. Thanks, adamv.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7514 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-05 16:04:50 +00:00
Ian Kelly db6bab5cb3 Fixed an Oracle error on double negations in where conditions. Fixed #7111
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7509 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-29 20:55:10 +00:00
Malcolm Tredinnick 2061b3f3ca Undo [7474]. I didn't think it through nearly carefully enough.
This means that all model construction now goes through the __init__() method
again.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7504 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-29 01:19:42 +00:00
Adrian Holovaty 14d6ee2dc9 Changed Query.get_columns() to quote the 'AS' column names in an extra_select situation, to match pre-queryset-refactor behavior. Added unit tests that verify this and provide an example
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7502 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 21:15:05 +00:00
Malcolm Tredinnick a97f690e5d Added the ability to pickle and unpickle QuerySets and Query classes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7499 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 14:14:41 +00:00
Malcolm Tredinnick db80f57c6e ValuesQuerySets (and subclasses) were inadvertently not caching their results.
Fixed.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7497 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 12:09:23 +00:00
Malcolm Tredinnick ba010ec1c0 Made some types of nested update queries very slightly more efficient at the
database level. Also worked around the fact that MySQL (and maybe other
backends we don't know about) cannot select from the table they're updating.

Fixed #7095.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7496 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 11:51:52 +00:00
Malcolm Tredinnick 1bb8260084 Allow Query objects to be values in query filters. This already existed for
relations, but not for normal fields. The latter comes up naturally in some
update statements.

Refs #7095


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7494 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 07:07:17 +00:00
Malcolm Tredinnick e07a457c00 Fixed #7096 -- The simplifications in [7461] weren't complete. They broke
multi-component exclude() calls. Fixed that.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7493 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 04:29:06 +00:00
Malcolm Tredinnick 356dfd5308 Fixed #7098 -- Old-style related-model order_by() syntax was being incorrectly
marked as erroneous. It's just more dangerous and risky, not forbidden. This
commit restores backwards compatibility there.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7490 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 02:27:19 +00:00
Adrian Holovaty 81edb50cac Migrated _setup_query() docstring to America
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7488 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 00:58:42 +00:00
Adrian Holovaty a209115969 Fixed a bug with the new QuerySet update() method where it wasn't committing the transaction (on Postgres, at least)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7487 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 00:58:21 +00:00
Adrian Holovaty d649d0f5f8 Fixed #7097 -- dates() queries now work as expected with select_related() -- that is, select_related() has no effect on the query. Thanks for reporting, Marco
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7486 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-28 00:20:40 +00:00
Malcolm Tredinnick d0c49e7b77 When retrieving a field by name, handle a missed case when the cache cannot be
initialised yet.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7478 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 11:44:11 +00:00
Malcolm Tredinnick 9c52d56f6f Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.

Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7477 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-27 02:50:16 +00:00
Malcolm Tredinnick 35afdedbed Fixed #6433 -- Handle some varied PostgreSQL version strings (beta versions and
Windows version strings). Patch from jerickso.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7415 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-13 02:04:10 +00:00
Ian Kelly 15a39f7fe5 Fixed #5985: Changed the lookups in the Oracle backend to use LIKEC instead of LIKE.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7412 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-04-10 17:44:40 +00:00
Malcolm Tredinnick c30a050e41 Removed the ado_mssql database backend.
It has not been maintained, contains bugs, and improved versions are available
externally(e.g. django-mssql and django-pyodbc at Google code).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7364 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-26 08:25:48 +00:00
Adrian Holovaty 3d779efbe5 Fixed #6867 -- Added some missing DeprecationWarnings to db.models.fields.related. Thanks, dcramer
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7362 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-25 05:13:08 +00:00
Malcolm Tredinnick 89e7b673d8 Fixed #5531 -- Changes a while back meant we are handling import errors from
database backends differently now. Which meant the MySQLdb version check was
being swallowed. Changed the exception type to ensure this is percolated
correctly. Patch from Ramiro Morales.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7358 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-24 14:02:44 +00:00
Malcolm Tredinnick b3b8422363 Fixed #6445 -- Allow model instances to be used as a default for ForeignKeys
(via a callable). Also updates the documentation of the "default" attribute to
indicate a callable can be used. Thanks, Philipe Raoult.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7331 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-20 06:56:23 +00:00
Jacob Kaplan-Moss 4457ba002d Fixed #5894: added FilePathField to newforms. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7323 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-19 22:29:11 +00:00
Malcolm Tredinnick 1b331f6c1e Fixed #6641 -- If we lose a race when creating a new object in get_or_create,
re-get the result from the database and return that. Thanks, Jeff Guinness and
Timothée Peignier.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7289 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-18 14:08:40 +00:00
Ian Kelly 4f5f8735e3 Fixed #6666: Corrected a bind param formatting issue when performing 'year' lookups on DateFields using Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7274 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-17 19:31:42 +00:00
Malcolm Tredinnick 732074541a Fixed #5883 -- Added __iter__ methods to the debug cursor and the postgresql backend cursor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7259 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-17 14:15:15 +00:00
Jacob Kaplan-Moss a9b4efc82b Re-enable substring lookups for IP address fields in Postgres using HOST() Thanks for the suggestion, Thomas Adamcik. Fixes #708.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7161 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-26 23:12:47 +00:00
Jacob Kaplan-Moss f7fbc289ad Reverted [7151] since it breaks exact IP lookups on PostgreSQL. Reopens #708
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7160 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-26 22:17:45 +00:00
Jacob Kaplan-Moss df5fef33c9 Beefed up support for "lazy" related objects. Now, in addition to ForeignKey("Model") you can also say ForeignKey("app.Model"). This means that cross-app recursive relations now work.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7158 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-26 21:13:16 +00:00
Malcolm Tredinnick 6482f1f887 Fixed #708 -- Fixed searching within IP fields on PostgreSQL.
Based on a patch from Matt McClanahan.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7151 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-23 09:15:35 +00:00
Malcolm Tredinnick 32402773f1 Fixed #3689, #5223 -- Fixed "1st of January" comparisons for SQLite without breaking the other backends.
Based on a patch from raminf and tests from Nebojsa Djordjevic.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7150 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-23 08:36:41 +00:00
Malcolm Tredinnick 6a796690e6 It makes sense that when you subclass an existing model field, you're often
going to be using the same database column type. Made that properly
inheritable (previously it was using the class name), at the cost of a little
more verboseness.

This is very slightly backwards incompatible (for subclasses of existing fields
that were relying on the old default).

Fixed #6556.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7133 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-19 02:58:41 +00:00
Malcolm Tredinnick 343fa35a2c Fixed #2936, #6500 -- Added a __hash__() method to Models (since we implement our own __eq__ method).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7132 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-19 01:59:34 +00:00
Malcolm Tredinnick f1a24be01c Fixed #6481 -- Fixed a bunch of import problems (and some whitespace cleanups).
Found by Bastian Kleineidam with help from pyflakes. Thanks.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7131 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-19 00:08:08 +00:00
Malcolm Tredinnick 16928a79e6 Tweaked [7098] to follow a more duck-typing approach.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7116 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-15 06:40:23 +00:00
Russell Keith-Magee 7d2a8f0e18 Fixed #6596 -- Corrected minor typo in comment. Thanks, cbmeeks@gmail.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7109 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-13 23:28:58 +00:00
Malcolm Tredinnick 5480a1eecf Fixed #6214 -- Added some small optimisations to model class initialisation.
Thanks, Ivan Illarionov.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7098 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-08 12:01:23 +00:00
Gary Wilson Jr cc7c6f3e46 Fixed #5422 -- Added a `raw` parameter to model `pre_save` and `post_save` signals, based on patch from `graham.carlyle@maplecroft.net`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7054 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-01 17:32:29 +00:00
Joseph Kocherhans fd20365b27 Fixed #6302. FileField no longer requires a value if one already exists. Thanks Brian Rosner and Øyvind Saltvik.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7021 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-17 18:03:21 +00:00
Ian Kelly 6929c0d4d1 Fixed #6254: Made fetchone() in the oracle backend correctly convert
strings to unicode objects.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6995 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-04 22:51:22 +00:00
Matt Boersma c5d3a925c7 Set Oracle stmtcachesize to 20 instead of 0 for a performance boost.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6965 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-21 18:49:07 +00:00
Matt Boersma 72d279a29f Rearranged an Oracle ALTER statement so it is run only once per new connection, not on every cursor creation. Thanks, Ian Kelly.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6963 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-20 23:06:30 +00:00
Malcolm Tredinnick 9229c34163 Fixed #6212 -- Give models.NullBooleanField the right default newforms field. Patch from SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6935 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-17 10:35:53 +00:00
Ian Kelly ed5eca598e Fixed ORA-01461 error when trying to store more than 4000 bytes in a TextField under Oracle
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6905 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-11 02:22:40 +00:00
Malcolm Tredinnick 90093e7965 Fixed #6147 -- Typo fix (that amazingly didn't stop the code working) in the code for loading a database module. Thanks, guido@python.org.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6903 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-09 10:18:56 +00:00
Malcolm Tredinnick 805c364fcf Fixed #3511 -- Changed QuerySet.get() to return a MultipleObjectsReturned exception, rather than an assertion error. Thanks, Gary Wilson and cheeming.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6838 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02 18:21:07 +00:00
Malcolm Tredinnick 5e5768ae83 Fixed #3323 -- More robust error handling for related objetcs. Thanks, Greg
Kopka and shaleh.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6835 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02 18:10:07 +00:00
Malcolm Tredinnick 348f2cbfc1 Fixed #5996 -- Add a pyscopg2 convertor for SafeUnicode -> unicode. Thanks, remco@diji.biz
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6816 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-01 22:26:24 +00:00
Ian Kelly bbc3a95557 Fixed #6007: Added DEFAULT_TABLESPACE and DEFAULT_INDEX_TABLESPACE
options to global_settings.py


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6801 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-01 19:23:49 +00:00
Ian Kelly c750f01b48 Fixed a PL/SQL syntax bug causing manage.py sqlall to fail when piped to
sqlplus, introduced in [5950].


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6799 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-01 18:50:43 +00:00
Malcolm Tredinnick 260f9c5112 Fixed #5989 -- Fixed a problem with values being incorrectly reused by
reference in field subclassing. Thanks, flupke.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6748 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 19:30:49 +00:00
Malcolm Tredinnick d0f5a58fbd Fixed #4653 -- Improved the logic to decide when to include (and select as
initial value) the blank choice for a model field with choices. Thanks to
Ilya Semenov for persisting with this.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6733 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 16:32:18 +00:00
Malcolm Tredinnick a4ea8d4e93 Fixed #3291 -- Allow calling get_absolute_url() with extra positional and
keyword arguments. Not usually required, but useful for people wanting to write
some kinds of customisations. Patch from __hawkeye__.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6732 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 16:32:09 +00:00
Malcolm Tredinnick ea100b607a Added the small changes necessary to make creating custom model fields easier.
Also includes some tests for this.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6651 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-05 13:59:42 +00:00
Malcolm Tredinnick 595e75e8dd Fixed #5729 -- For MySQL (only), always delay the creation of foreign key
references, for all tables, until after the table has been created. This means
that when using the InnoDB storage engine, true foreign key constraints are
created (inline "REFERENCES" are ignored by InnoDB, unfortunately).

Fully backwards compatible.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6650 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-04 05:05:24 +00:00
Adrian Holovaty c599de2ac6 Added a BaseDatabaseOperations.last_executed_query() hook, which allows a database backend to specify how to get the last-executed query on a given cursor. Implemented it for the psycopg2 backend. This means that for psycopg2, the SQL statements in django.db.connection.queries will now reflect the exact SQL as sent to the server, instead of a naive and misleading string-interpolated version
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6601 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-23 19:00:31 +00:00
Malcolm Tredinnick f20b254ccc Fixed #899 -- Use model field default values as formfield initial values in
form_for_model(). Patch from David Danier and PhiR. Thanks.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6568 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-20 13:01:40 +00:00
Gary Wilson Jr 73f495158c Fixed #5710 -- Fixed a missing table name quoting in the postgresql backend, thanks davep@atomicdroplet.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6507 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-14 05:53:56 +00:00
Malcolm Tredinnick 185848a526 Fixed #5641 -- Handle lazy translations correctly when used as default arguments. Thanks, permon.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6453 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-04 01:55:51 +00:00
Jacob Kaplan-Moss 960c1263b6 Fixed #5559: instances sent via post-save signals no longer have pks of None. Thanks, Joseph Kocherhans.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6411 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-24 18:27:42 +00:00
Jacob Kaplan-Moss 980fa8b827 Fixed #231: all fields that should take max_length now do. Thanks, Don Spaulding.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6378 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-19 23:33:57 +00:00
Malcolm Tredinnick c012b8964e Fixed #4067 -- Fixed validation of IPAddressFields in newforms. Thanks to neils and the team in the Copenhagen sprint group.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6357 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-16 11:38:32 +00:00
Malcolm Tredinnick e2409750f8 Fixed #3703 -- Added pk property to models. Thanks, Collin Grady and jeromie@gmail.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6346 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-16 01:57:25 +00:00
Jacob Kaplan-Moss 07447a0f56 Fixed #5454: settings.DATABASE_BACKEND may now refer to an external package (i.e. one located outside the Django source. Thanks, George Vilches.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6316 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-15 19:25:20 +00:00
Malcolm Tredinnick 388182b622 Fixed #3032 -- Added some useful methods and attributes so that AnonymousUser can proxy for a User a bit more logically. Patch from semenov.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6299 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-15 18:01:29 +00:00
Malcolm Tredinnick 7a6abfdd3b Fixed #5444 -- Changed manipulator class construction to use type(), rather than types.ClassType(). Helps with Jython compatibility. Patch from Leo Soto.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6277 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-15 11:06:32 +00:00
Malcolm Tredinnick 1baae32e16 Fixed #4879 -- Added 'created' arg to post_save signal. This is True is a new object is created. Patch from George Vilches.
Fully backwards compatible, because signal receivers do not have to be able to accept all the arguments (thankyou, robust_apply()).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6269 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-15 09:14:51 +00:00
Russell Keith-Magee cf3c94b26d Fixed #4415 -- Added formfield method to PositiveIntegerField, so that those fields get validated correctly. Thanks, Oggie Rob.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6252 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-15 02:37:07 +00:00
Ian Kelly 8c5214d9b4 Made Oracle backend cast CharField values of None to u'' instead of ''
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6248 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 23:23:55 +00:00
Jacob Kaplan-Moss 4c0ac53ff8 Fixed a missing import in mysql backend. Thanks for pointing it out, mattmcc.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 23:02:39 +00:00
Ian Kelly 17cd87a264 Fixed an Oracle sqlflush / sequence reset column name bug exposed by the new test case in [6195].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6230 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 22:07:54 +00:00
Adrian Holovaty dfdbf9ec1e Fixed #5161 -- Changed MySQL backend only to report warning once. Thanks, durdinator
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6229 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 22:05:58 +00:00
Ian Kelly f180d95903 Fixed #4896: fixed #4765: Patch for cursor.executemany using oracle and
sqlite3. Thanks, jdetaeye@www.frepple.com


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6218 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 21:32:25 +00:00
Adrian Holovaty 9cccf59db5 Fixed #5460 -- unique_together now accepts a single tuple for convenience. Thanks, Deryck Hodge
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6213 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 20:36:53 +00:00
Adrian Holovaty 0d52d2b2f9 Fixed #5342 -- Added max_length parameter to EmailField. Thanks, donspaulding and gwilson
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6205 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 19:22:43 +00:00
Jacob Kaplan-Moss eea935a7f4 Fixed #5448: you can now use unicode characters in primary keys. Thanks, pigletto.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6200 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 18:36:04 +00:00
Matt Boersma a6b1d65e33 Fixed #5226. Now we check the Oracle version and give an explicit
error when we encounter a regex operator that isn't supported on 9i or 
earlier.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6198 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 18:26:07 +00:00
Ian Kelly 93f60163e8 Fixed #5218: Made Oracle create autoinc triggers using the correct name
of the AutoField column rather than always assume "ID".


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6195 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 18:12:36 +00:00
Jacob Kaplan-Moss 42f4f44356 Fixed #3146: DateFields no longer barf when confronted by strings. Thanks, Deepak Thukral.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6193 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 16:48:47 +00:00
Adrian Holovaty f36e96cc9c Added django/db/backends/creation.py, with BaseCreation. Refs #5461
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6192 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 16:44:53 +00:00
Malcolm Tredinnick 595bf6b691 Fixed #1760 -- Unwound a subselect in an update for order_with_respect_to handling. Required for MySQL and doesn't hurt too much for other platforms. thanks, Christopher Lenz, James Turnbull and Simon Litchfield.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6187 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 13:56:36 +00:00
Malcolm Tredinnick 134bf3a26b Backed out [6165]. It breaks things for people using psycopg2 because it requires psycopg to also be installed due to imports.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6171 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 06:21:25 +00:00
Gary Wilson Jr 30b24a6cce Refs #4299 -- Removed some code duplication in the postgresql introspection modules by letting the `postgresql_psycopg2` backend use identical functions from the `postgresql` backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6165 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 05:33:39 +00:00
Gary Wilson Jr da0fef756c Fixed #5123 -- Fixed ImageField to pass along keyword arguments in its formfield method.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6154 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 02:54:12 +00:00
Russell Keith-Magee 12146f34fd Removed code that was recasting major errors found during application import. If an application can't be imported, it now throws a full stack trace with the problem, rather than reporting the problem as a one line message.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6087 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-10 07:00:46 +00:00
Gary Wilson Jr ef088d5f36 Fixed imports to adhere to PEP 8 and stripped trailing whitespace.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6066 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-08 05:11:17 +00:00
Gary Wilson Jr 41b3a45fc5 Fixed #3557 -- Made `SlugField` inherit from `CharField` so that its `max_length` is properly set. Removed `get_manipulator_field_objs` method since it's already provided by `CharField`. Thanks, Russell Cloran.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6065 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-08 05:09:39 +00:00
Adrian Holovaty 41576fea71 Fixed #5263 -- Updated docstring for sqlite3 backend. Thanks, Paul Bx
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6035 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-02 20:04:44 +00:00
Adrian Holovaty 8b8a36c7d0 Changed postgresql and postgresql_psycopg2 backends NOT to do a SELECT version() for every connection, which was ludicrous. Now the version is only retrieved if it needs to be, via a lazy loader.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6012 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-25 19:24:47 +00:00
Adrian Holovaty 861b28f37e Fixed #5055 -- Changed Postgres DatabaseOperations.sql_flush() to use 'SELECT setval()' instead of 'ALTER SEQUENCE', because the latter only works with Postgres 7.3+. Thanks, Don Arbow
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6009 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-25 18:56:43 +00:00
Adrian Holovaty 6d387d3d1b Fixed #5255 -- It's now possible again to use Django without a database. This had temporarily gotten buggy after the django.core.management refactoring last week
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6002 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-25 18:27:57 +00:00
Matt Boersma 377fe7ce77 Fixed breakage of test suite for Oracle by adding a null check.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5992 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-21 17:06:06 +00:00
Adrian Holovaty b367ec2244 Made various negligible formatting cleanups to the database backends
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5983 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:32:06 +00:00
Adrian Holovaty 14db37319b Refactored OPERATOR_MAPPING so that it exists as django.db.connection.operators instead of django.db.backend.OPERATOR_MAPPING. Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5982 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:26:55 +00:00
Adrian Holovaty b3912d3609 Changed backend create_test_db() and destroy_test_db() hooks NOT to take the backend as an argument, as the backend as an object is going away
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:16:55 +00:00
Adrian Holovaty e267bec83a Simplified max_name_length() call in oracle database backend
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5979 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:10:20 +00:00
Adrian Holovaty b105a52882 Refactored get_drop_sequence() to DatabaseOperations.drop_sequence_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5978 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:08:32 +00:00
Adrian Holovaty 4c5248f98f Refactored get_field_cast_sql() to DatabaseOperations.field_cast_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5977 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 03:03:40 +00:00
Adrian Holovaty e13ea3c70d Refactored get_query_set_class() to DatabaseOperations.query_set_class(). Also added BaseDatabaseFeatures.uses_custom_queryset. Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5976 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 02:39:05 +00:00
Adrian Holovaty 6d8e6090e5 Removed a bunch of legacy django.db.backend imports
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5975 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 02:28:40 +00:00
Adrian Holovaty 1a8f9b2b97 Implemented BaseDatabaseFeatures and changed all code to access it -- connection.features.foo instead of backend.foo
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5974 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 02:20:33 +00:00
Adrian Holovaty 4f82250512 Removed unneeded import from postgresql_psycopg2/base.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5973 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:30:11 +00:00
Adrian Holovaty f4b397087c Moved postgresql backend DatabaseOperations class into a new module, postgresql/operations.py, so that it can be imported by both the postgresql and postgresql_psycopg2 backends. Hence the two backends no longer have a duplicated DatabaseOperations class
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5972 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:26:46 +00:00
Adrian Holovaty c2c3e93096 Removed _dict_helper() DB backend helper function, as it wasn't being used anymore
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5971 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:15:32 +00:00
Adrian Holovaty a6a5e3cf32 Removed backend.dictfetchall(), as it wasn't being used anywhere
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5970 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:14:53 +00:00
Adrian Holovaty ba49e7be08 Removed backend.dictfetchmany(), as it wasn't being used anywhere
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5969 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:14:03 +00:00
Adrian Holovaty 1b4cfd4fea Removed backend.dictfetchone(), as it wasn't being used anywhere
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5968 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:13:12 +00:00
Adrian Holovaty 221f99ed58 Refactored quote_name() to DatabaseOperations.quote_name(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:03:33 +00:00
Adrian Holovaty d4f218bd91 Refactored get_tablespace_sql() to DatabaseOperations.tablespace_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5966 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:30:19 +00:00
Adrian Holovaty 13061bf20b Refactored get_start_transaction_sql() to DatabaseOperations.start_transaction_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5965 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:24:03 +00:00
Adrian Holovaty 147e99a08a Refactored get_sql_sequence_reset() to DatabaseOperations.sequence_reset_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5964 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:21:10 +00:00
Adrian Holovaty aaed6e04ec Refactored get_sql_flush() to DatabaseOperations.sql_flush(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5963 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:15:53 +00:00
Adrian Holovaty c44fb66551 Refactored get_random_function_sql() to DatabaseOperations.random_function_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5962 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 00:04:20 +00:00
Adrian Holovaty aaf8760227 Refactored get_pk_default_value() to DatabaseOperations.pk_default_value(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5961 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:59:06 +00:00
Adrian Holovaty e4b7e369dd Refactored get_max_name_length() to DatabaseOperations.max_name_length(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5960 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:53:39 +00:00
Adrian Holovaty d3e69c3a47 Refactored get_limit_offset_sql() to DatabaseOperations.limit_offset_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5959 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:24:59 +00:00
Adrian Holovaty 5ce050a5f5 Refactored get_last_insert_id() to DatabaseOperations.last_insert_id(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5958 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:18:43 +00:00
Adrian Holovaty 5a6426448f Refactored get_fulltext_search_sql() to DatabaseOperations.fulltext_search_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5957 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:13:06 +00:00
Adrian Holovaty 23a736dca9 Refactored get_drop_foreignkey_sql() to DatabaseOperations.drop_foreignkey_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5956 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:07:34 +00:00
Adrian Holovaty 8e84d35d38 Refactored get_deferrable_sql() to DatabaseOperations.deferrable_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5955 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 23:03:38 +00:00
Adrian Holovaty ed8e392f77 Added extra documentation to BaseDatabaseOperations.datetime_cast_sql() docstring
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5954 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:57:08 +00:00
Adrian Holovaty 29f67dce9e Refactored get_datetime_cast_sql() to DatabaseOperations.datetime_cast_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5953 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:55:05 +00:00
Adrian Holovaty 5f51f0524a Refactored get_date_trunc_sql() to DatabaseOperations.date_trunc_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:47:43 +00:00
Adrian Holovaty aab04a4c2f Refactored get_date_extract_sql() to DatabaseOperations.date_extract_sql(). Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5951 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:40:06 +00:00
Adrian Holovaty 38b5d7f23d Began implementing BaseDatabaseOperations class for every database backend. This class will be used to hold the database-specific methods that currently live at the module level in each backend. Only autoinc_sql() has been implemented so far.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5950 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 22:29:57 +00:00
Adrian Holovaty 7c41b19c8a Refactored all database backends to inherit from a common base class to remove quite a bit of duplicated code. Thanks for the patch, Brian Harring. Refs #5106
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5949 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 21:30:57 +00:00
Malcolm Tredinnick 7e8efcd4d9 Fixed #5087 -- Fixed support for TextField filtering with Oracle. Thanks, Ian Kelly.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5943 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 12:37:00 +00:00
Malcolm Tredinnick 390e91db51 Tweaked the unset primary key check from [5933] to accommodate models created in the oldforms style. It's a backwards-compatibility hack that we can remove when oldforms go away. See #2160 for discussion. Fixed #5204, #2160. Refs #5102.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5934 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-19 03:23:31 +00:00
Malcolm Tredinnick 6ed780d796 Fixed #5102 -- Fixed model saving so that 0 can be used as a primary key value. Thanks, oggie rob.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5933 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-18 07:40:59 +00:00
Malcolm Tredinnick 7969c1ba05 Renamed Cache to AppCache and cache_ready() to app_cache_ready() from [5919] in order to avoid any potential confusion with Django's caching middleware functionality when reading the code.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5922 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-18 04:16:04 +00:00
Malcolm Tredinnick 3219a60167 Rewrote portions of the app- and model-cache initialisation to handle some corner cases. It is now possible to use m2m relations before everything is imported and still get the right results later when importing is complete. Also, get_apps() should always return the same results, so apps won't randomly disappear in the admin interface.
Also reorganised the structure of loading.py, since the number of global variables was exploding. The public API is still backwards compatible.

Fixed #1796 and #2438 (he claims, optimistically).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5919 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-17 17:23:15 +00:00
Adrian Holovaty b6c3ff366e Updated Oracle 'syncdb' call from [5906] to use the options that it previously had
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5908 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-16 19:27:58 +00:00
Matt Boersma 3e20e7cc41 Fixed runtests.py failing on Oracle after django.core.management was
refactored.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5906 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-16 17:47:30 +00:00
Adrian Holovaty 08c47803bb Removed 'LIMIT 1' from the [5882] change, as it's not supported by Oracle
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5883 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-14 03:26:42 +00:00
Adrian Holovaty 947ca5123e Fixed #5030 -- Removed 'COUNT()' from Model.save() when determining whether a row exists. We're now using a SELECT 1 LIMIT 1 instead, as it's more efficient in some databases. Thanks, zigiDev@mac.com and the various folks who verified this patch works
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5882 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-13 21:42:37 +00:00
Malcolm Tredinnick 31ba14761e Fixed #5134 -- Return empty strings as Unicode in psycopg1 backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5834 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-11 05:23:19 +00:00
Gary Wilson Jr 049212e950 Fixed #5115 -- Fixed `QuerySet` slices to allow longs.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5831 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-08 21:09:55 +00:00
Russell Keith-Magee a49fd11055 Removed a redundant directory join during FileField form saving. Thanks to David Danier's eagle eyes for picking up this one.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5826 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-07 11:20:15 +00:00
Adrian Holovaty 3ed4997611 Fixed British spelling of 'customize' and 'behavior' in Manager.get_query_set() docstring
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5823 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-06 20:27:04 +00:00
Russell Keith-Magee fbd1a6277e Fixed #3297 -- Implemented FileField and ImageField for newforms. Thanks to the many users that contributed to and tested this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5819 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-06 13:58:56 +00:00
Gary Wilson Jr 212ee65be7 Fixed #2101 -- Renamed `maxlength` argument to `max_length` for oldforms `FormField`s and db model `Field`s. This is fully backwards compatible at the moment since the legacy `maxlength` argument is still supported. Using `maxlength` will, however, issue a `PendingDeprecationWarning` when used.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-05 05:14:46 +00:00
Gary Wilson Jr f27774ee0a Fixed call to `ugettext`, which is imported as `_`.
Changed raise to conform to PEP 3109 and wrapped the long line.
Added beginnings of tests for model fields.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5778 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-30 17:25:35 +00:00
Adrian Holovaty 5b8d2c9f0d Fixed bug with using values() and extra(select) in the same QuerySet, with a select dictionary containing more than a few elements. This bug was identified in unit test from [5767]. The problem was that we were relying on the dictionary's .items() ordering, which is undefined
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5768 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-27 22:07:42 +00:00
Gary Wilson Jr bac6a2f88e Fixed #4945 -- Removed unused `GET_ITERATOR_CHUNK_SIZE` definition from manager.py. `GET_ITERATOR_CHUNK_SIZE` is already defined in query.py. Thanks zigiDev@mac.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5743 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-22 02:18:36 +00:00
Adrian Holovaty ac2b9f2a3f Added a db_type() method to the database Field class. This is a hook for calculating the database column type for a given Field. Also converted all management.py CREATE TABLE statements to use db_type(), which made that code cleaner. The Field.get_internal_type() hook still exists, but we should consider removing it at some point, because db_type() is more general. Also added docs -- the beginnings of docs on how to create custom database Field classes. This is backwards-compatible.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5725 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-20 06:28:56 +00:00
Gary Wilson Jr 9a1c21809e Removed unused variable and changed comments about `permalink` decorator into a docstring.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5719 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-16 13:47:43 +00:00
Gary Wilson Jr 193e6db457 Refs #2591 -- Removed int conversion and try/except since the value in the single-item list is already an int. I overlooked this in my original patch, which was applied in [5679].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5690 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-13 20:36:01 +00:00
Malcolm Tredinnick 54a71805aa Fixed #2591 -- Fixed a problem with inspectdb with psycopg2 (only). Patch from
Gary Wilson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5679 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-13 08:52:07 +00:00
Russell Keith-Magee 2d6d20def7 Fixed #4459 -- Added 'raw' argument to save method, to override any pre-save processing, and modified serializers to use a raw-save. This enables serialization of DateFields with auto_now/auto_now_add. Also modified serializers to invoke save() directly on the model baseclass, to avoid any (potentially order-dependent, data modifying) behavior in a custom save() method.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5658 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-12 07:45:35 +00:00
Malcolm Tredinnick 3198b64516 Fixed #4776 -- Fixed a problem with handling of upload_to attributes. The new
solution still works with non-ASCII filenames. Based on a patch from
mike.j.thompson@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5625 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-06 10:21:14 +00:00
Malcolm Tredinnick 671fb8aa53 Fixed #4770 -- Fixed some Unicode conversion problems in the mysql_old backend
with old MySQLdb versions. Tested against 1.2.0, 1.2.1 and 1.2.1p2 with only
expected failures.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5623 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-06 08:04:04 +00:00
Malcolm Tredinnick 953badbea5 Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.

Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
Russell Keith-Magee 4a892f4d86 Fixed #4689 -- Added some missing methods to the dummy backend. Thanks for the report, Forest Bond.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5557 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-28 02:52:54 +00:00
Jacob Kaplan-Moss 24512a74be Fixed #1465: added support for regex lookups. Thanks, Tom Tobin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5555 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-27 18:58:10 +00:00
Malcolm Tredinnick 4ac1de31cd Fixed #4686 -- Do not permit empty strings in IPAddressField. Should be fully
backwards compatible, but fixes an Oracle subtlety. Thanks, Ian Kelly.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5544 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-26 12:59:49 +00:00
Malcolm Tredinnick 14161dba6b Fixed #4678 -- Fixed table name matching during syncdb for pyscopg2 backend
(the psycopg backend was already correct). Patch from tailofthesun@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5528 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-25 03:08:00 +00:00
Malcolm Tredinnick ac64e91a0c Merged boulder-oracle-sprint branch (r3965:5512) back into trunk. All
expected tests pass for all databases.


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


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5514 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-23 03:18:22 +00:00
Malcolm Tredinnick 86fd59cfa5 Fixed #4432 -- Fixed PostgreSQL sequence resetting in the case when a table has
no rows yet. Thanks, mrmachine.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5455 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-10 03:31:26 +00:00
Malcolm Tredinnick 6fc10f50b0 Fixed #4518 -- Added handling of empty strings in typecast_decimal() for
SQLite's benefit. Thanks, Richard House.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5450 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-10 01:52:56 +00:00
Simon Willison 4cda993213 rollback on dummy database now has no effect (previously raised an error). This means that custom 500 error pages (and e-mailed exceptions) now work even if a database has not been configured. Fixes #4429.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5410 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-01 16:30:38 +00:00
Jacob Kaplan-Moss bf2e62aa3c Fixed #3050: you can now use extra(select=...) with values(). Thanks, Honza Kral
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5385 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-31 02:22:41 +00:00
Malcolm Tredinnick 9eada8ad62 Fixed #4357 -- Removed a type conversion that was only introduced in
MySQLdb-1.2.1 (and was introduced to Django in [5302]).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5313 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-22 04:31:19 +00:00
Malcolm Tredinnick 92c35a0617 Fixed #2365, #3324 -- Renamed FloatField to DecimalField and changed the code
to return Decimal instances in Python for this field. Backwards incompatible
change.

Added a real FloatField (stores floats in the database) and support for
FloatField and DecimalField in newforms (analogous to IntegerField).

Included decimal.py module (as django.utils._decimal) from Python 2.4. This is
license compatible with Django and included for Python 2.3 compatibility only.

Large portions of this work are based on patches from Andy Durdin and Jorge
Gajon.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@5302 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-21 01:29:58 +00:00
Russell Keith-Magee fd17163481 Fixed #4231 -- Added quoting for sequence names on sequence reset for PostgreSQL. This was causing difficulties if table or application names were capitalized. Thanks for the report, Mark Jarecki.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5204 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-12 15:21:33 +00:00
Malcolm Tredinnick 1c53661bd1 Moved generic relations into django.contrib.contenttypes, since it depends on
that to work. Backwards incompatible change.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5172 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-08 10:59:35 +00:00
Malcolm Tredinnick 93e2f246fd Fixed #4144 -- Only check sys.modules when required during Model class
construction. Patch from Marty Alchin.


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

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


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5133 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-01 03:21:54 +00:00
Malcolm Tredinnick 157ade371b Fixed #4084 -- Added formfield() support to the USStateField model field.
Thanks, polpak@yahoo.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5130 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-01 02:35:15 +00:00
Malcolm Tredinnick d9cc22b3e3 Fixed #3268 -- Changed default model formfields to use a select widget when the
field has a choices attribute. Based on a patch from mrmachine.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5119 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-28 14:18:03 +00:00
Malcolm Tredinnick b09bdd2ae8 Refactored the formfield() methods on models.fields.Field subclasses slightly
to remove some repetition.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5118 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-28 13:55:24 +00:00
Malcolm Tredinnick 439cb4047f Fixed #4040 -- Changed uses of has_key() to "in". Slight performance
improvement and forward-compatible with future Python releases. Patch from Gary
Wilson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-26 13:30:48 +00:00
Malcolm Tredinnick b3e0b59def Fixed #3450 -- Exposed IntegrityError in a backend-neutral fashion. This is a
useful error to be able to catch explicitly. Thanks, enlight.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5076 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-25 10:18:56 +00:00
Malcolm Tredinnick eb107e1ae9 Fixed #4048 -- When introspecting a MySQL database, map CHAR(n) fields to
Django's CharField type, not TextField. Thanks, Bill Fenner.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5042 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-20 10:05:39 +00:00
Russell Keith-Magee c5f08954d5 Fixed #4057 -- Fixed problem with quoting of sequence names on Postgres backends. Thanks, Gary Wilson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5017 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-17 11:11:26 +00:00
Adrian Holovaty 4ee7a7be95 Negligible space changes to django/db/models/query.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4986 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-09 15:35:19 +00:00
Russell Keith-Magee bbeb62c9af Backwards-incompatible change -- Removed LazyDate helper class. To preserve existing functionality, query arguments can now be callable. Callable query arguments are evaluated with the query is evaluated.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4985 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-09 13:28:09 +00:00
Russell Keith-Magee 1245b5c01e Backwards-incompatible change -- Renamed localflavor.usa to localflavor.us to match naming of other flavors.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4954 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-08 11:21:00 +00:00
Russell Keith-Magee 07f599ca5c Fixed the ADO backend to match the required interface and normalized naming of parameters.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4938 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-06 02:27:18 +00:00
Russell Keith-Magee dabd96646c Fixed #3790 -- Fixed a problem with sequence resetting during fixture loads when using Postgres. Thanks to Jon Ballard and scott@staplefish.com for the report, and to Zach Thompson for suggesting a solution.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4937 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-06 02:25:58 +00:00
Adrian Holovaty 4e31a17e9e Negligible comment formatting change in django/db/models/base.py (from [4881])
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4893 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-01 05:25:03 +00:00
Malcolm Tredinnick 1109e722aa Fixed #2363 -- Improved base class checking in ModelBase metaclass. Thanks to
combined work from phil.h.smith@gmail.com and Chris.Wesseling@cwi.nl.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4881 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-31 12:02:37 +00:00
Malcolm Tredinnick 858ac05802 Fixed #2351 -- Fixed problem with using ".count" attribute of QuerySets in
templates.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4772 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-22 03:00:12 +00:00
Malcolm Tredinnick 3f3f51d942 Fixed a mistaken import from the mysql backend that had snuck through.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4768 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-21 20:44:15 +00:00
Malcolm Tredinnick dcc8442390 Added a mysql_old backend that matches the mysql backend prior to [4724]. This
is only for backwards compatibility purposes.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4767 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-21 03:27:03 +00:00
Malcolm Tredinnick 1f9711ffb0 Fixed #3754 -- Re-introduced utf-8 as default encoding for interaction with
MySQL backend (a side-effect of [4724]). Thanks Andy Dustman and Michael
Radziej.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4760 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-20 23:32:39 +00:00
Russell Keith-Magee 55a67ae3f0 Fixed #3738 -- Minor inline documentation fix. Thanks, Simon.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4754 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-20 11:09:40 +00:00
Russell Keith-Magee 83bed03a59 Fixed #3741 -- Fixed serialization of GenericRelations. Thanks for the report, Alexander Solovyov.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4752 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-19 11:57:53 +00:00
Malcolm Tredinnick cb624b1377 Fixed #3747 -- Added a stricter MySQLdb version check so that (1, 2, 1,
'final', 2) passes and (1, 2, 1, 'gamma') does not. Also fixed a problem in the
error reporting when the check fails.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4751 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-18 19:16:47 +00:00
Malcolm Tredinnick f9c4ce5123 Fixed #2635 -- Added improved MySQL backend support from Andy Dustman. Also
added database.txt documentation; currently only describing Django-related
features of MySQL versions.

As of this commit, there are four known test failures due to (a) no transaction
support with MyISAM storage engine and (b) MySQLdb automatically creating
decimal types for Django's "float" field.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4724 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-14 12:08:19 +00:00
Russell Keith-Magee 400ee02661 Added to_python implementation for NullBoolean Fields. This was required for the XML serializer.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4717 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-13 00:35:47 +00:00
Malcolm Tredinnick e833595bc8 An improved version of the change attempted in [4693]: retain backwards
compatibility with hand-crafted oldforms without breaking edit_inline.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4698 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-10 07:37:08 +00:00
Malcolm Tredinnick cc8d656569 Fixed #3024 -- Fixed database commit() and rollback() behaviour so it works
consistently if you execute them before Django has made a database connection.
Thanks Bastian Kleineidam.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4691 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-09 07:55:40 +00:00
Malcolm Tredinnick 43809de79d Fixed #1839, #2415, #2536 -- Fixed a generated name clash that was common in
self-referential and circular relations. A lot of community debugging went into
this fix, so thanks to bmurdock@gmail.com, Marek Kubica, ramiro, Michael
Radziej (the last two giving test cases showing the problem) and James Bennett
(who did the hard work to actually diagnose the true problem and fix it).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4676 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-08 03:21:35 +00:00
Malcolm Tredinnick dd99bc7d02 Fixed #3627 -- Made [4659] compatible with Python 2.3. Thanks, Gary Wilson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4662 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-02 05:15:27 +00:00
Jacob Kaplan-Moss a72f908924 Changed the postgres version getting code to use cursor.fetchone() instead of dictfetchone(); some versions (including mine) of psycopg don't export dictfetch functions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4660 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-01 17:54:35 +00:00
Russell Keith-Magee f2582eb972 Fixes #2333 -- Added test fixtures framework.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4659 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-01 13:11:08 +00:00
Jacob Kaplan-Moss 4477f50f0b Added a "depth" argument to select_related() to control how many "levels" of relations select_related() is willing to follow (refs #3275).
Also added unit tests for select_related().

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4645 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-28 15:24:05 +00:00
Jacob Kaplan-Moss 9da791aa6b Fixed #3581, a small typo in OneToOneField.formfield(). Thanks, Andrew Sutherland.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4611 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 17:38:55 +00:00
Jacob Kaplan-Moss 51f39d59bd Fixed #3390: the serializer can now contain forward references. Thanks, Russ.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4610 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 17:33:27 +00:00
Jacob Kaplan-Moss a30e3fca48 Objects with FileFields no longer get save() called multiple times from the AutomaticManipulator! This fixes #639, #572, and likely others I don't know of.
This may be slightly backwards-incompatible: if you've been relying on the multiple-save behavior (why?), then you'll no longer see that happen.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 17:17:11 +00:00
Malcolm Tredinnick c27ba0b209 Fixed #2363 -- Fixed subclass checking in ModelBase to allow for mixin
superclasses. Thanks phil.h.smith@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4607 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 09:06:23 +00:00
Jacob Kaplan-Moss 670ea04e47 Cleaned up comments from [4597] to be a bit more clear.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4598 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 06:21:24 +00:00
Jacob Kaplan-Moss 90acc8ff7e Fixed #3438: improved the speed of Model.__init__ (about 1/3 faster, it appears). Thanks (a lot!) to Brian Harring.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4597 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 06:16:19 +00:00
Jacob Kaplan-Moss 6bd07383c0 Fixed #3172: Model.validate() no longer raises TypeErrors on empty Date*Fields. Thanks, floguy@gmail.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4592 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-26 05:07:12 +00:00
Jacob Kaplan-Moss dcdaa4ac3c Fixed #3459: Django no longer runs SET TIME ZONE for every query when using Postgres. This should result in a pretty noticible speedup for Postgres users, so many thanks to Jack Moffitt for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4573 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-25 16:18:46 +00:00
Jacob Kaplan-Moss f2aa1b93e0 Fixed silly typo in [4651].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4563 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-23 23:05:25 +00:00
Jacob Kaplan-Moss 16bd0aa991 Fixed #3541: queryset.count() now respects the queryset cache.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4561 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-23 20:58:28 +00:00
Adrian Holovaty abc949f584 Changed database PhoneNumberField to use USPhoneNumberField as its newforms form field (instead of IntegerField)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4556 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-21 05:59:46 +00:00
Adrian Holovaty e56934b9b9 Fixed #3257 -- Added newforms ModelChoiceField and ModelMultipleChoiceField, which are now used by form_for_model() and form_for_instance(). Thanks for the patch, Honza Kral, floguy@gmail.com and kilian.cavalotti
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4547 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-20 02:42:07 +00:00
Malcolm Tredinnick babc0793e3 Fixed behaviour of admin interface (and AddManipulator) when
min/max_num_in_admin is specified without num_in_admin. A consequence of
changes in [4500].


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4542 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-19 04:18:46 +00:00
Adrian Holovaty 4c4209b144 Changed __year lookup to use a BETWEEN SQL statement instead of comparing the result of EXTRACT(year). This should be more efficient.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4505 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-14 06:32:32 +00:00
Malcolm Tredinnick ff46f0fbcf Fixed #3394 -- Made min_num_in_admin be respected on new object creation. Patch
from torne-django@wolfpuppy.org.uk.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4500 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-13 06:27:28 +00:00