Commit Graph

847 Commits

Author SHA1 Message Date
Jacob Kaplan-Moss bca5327b21 Added generic foreign key support to Django. Much thanks to Ian Holsman and
Luke Plant -- most of this code is theirs.  Documentation is to follow; for now
see the example/unit test.  Fixes #529.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3134 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-16 19:18:30 +00:00
Malcolm Tredinnick 062bae3bb3 Fixed the detection of when a custom manager is required because an 'objects'
field already exists.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3131 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-15 14:05:33 +00:00
Malcolm Tredinnick 28e643743f Fixed #2164 -- Create correct SQL when pk column name is not the same as the
attribute name. Thanks, Russell Cloran.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3130 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-15 11:28:28 +00:00
Malcolm Tredinnick 686c5a2f88 Fixed the empty model saving case so that it retrieves the primary key id. Also
updated the tests to test this case.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3118 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-12 12:49:14 +00:00
Malcolm Tredinnick 7e2b888a2d Fixed #2108 -- allow saving of empty models, rather than just dropping them.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3115 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-08 15:14:06 +00:00
Adrian Holovaty 2abfd5dd58 Fixed #2109 -- Convert old-style classes to new-style classes throughout Django. Thanks, Nicola Larosa
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3113 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-08 05:00:13 +00:00
Malcolm Tredinnick 89920e058f Fixed #2108 -- do not try to save an empty model.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3104 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-08 00:13:52 +00:00
Adrian Holovaty b3a6348bc2 Added Manager.get_or_create()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3092 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-07 00:09:29 +00:00
Jacob Kaplan-Moss 86d585a0a1 Backed out [3088] which was a premature commit with a message meant for another term window :)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3089 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-06 12:30:26 +00:00
Jacob Kaplan-Moss 0909c97e60 BNW: Added modpython handler to autosettings
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3088 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-06 12:20:45 +00:00
Adrian Holovaty a5b7c29816 Changed all model unit tests to use __str__() instead of __repr__(). Also slightly changed related-object DoesNotExist exception message to use repr instead of str
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3075 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-04 00:23:51 +00:00
Adrian Holovaty 168429d597 Fixed #593 -- Added 'search' DB-API lookup type, which does full-text index searches in MySQL
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3073 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-03 23:28:24 +00:00
Luke Plant 9b86db9bf2 Eliminated lots of mutable default arguments (since they are bugs
waiting to happen and are memory leaks too).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3070 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-03 13:37:34 +00:00
Adrian Holovaty fa9722489b Fixed #2061 -- Fixed PostgreSQL index introspection in tables that have dropped columns. Thanks, Chris Chamberlin
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3047 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-01 16:27:41 +00:00
Adrian Holovaty 8cd32bddab Fixed bug in Model._get_next_or_previous_in_order()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3046 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-01 15:01:22 +00:00
Adrian Holovaty 56131d0fb9 Fixed #2052 -- Fixed some threading issues for FreeBSD. Thanks, scott@clued-in.co.uk
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3045 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-01 04:57:10 +00:00
Adrian Holovaty b4be0d2487 Fixed #1454 -- Improved DB API quote_only_if_word() so that it doesn't quote 'select' parameters that are not all word characters. Thanks, dja@cdc.msbx.net
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3044 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-01 04:47:56 +00:00
Adrian Holovaty 5c5d60aa63 Fixed #411 -- CursorDebugWrapper now supports pyformat paramstyle
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3038 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-01 03:57:07 +00:00
Adrian Holovaty 45518a052b Fixed #2038 -- QuerySet._combine now combines where clause. Thanks, graham@darkcoding.net
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3019 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-31 14:52:33 +00:00
Luke Plant 037f8d5804 Fixed #1584 - auto_now_add fields now work when saving multiple times.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3002 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-29 17:08:58 +00:00
Luke Plant 60c3e55b1f Fixed bug with QuerySet.exclude() failing to do negations on Q objects, and
at the same time generalised exclude/QNot so that they work for 'external'
Q objects i.e. ones that simply have 'get_sql' defined.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@2997 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-26 23:41:43 +00:00
Adrian Holovaty c21acb6aeb Fixed #1732 -- AttributeErrors in models are no longer ignored by the model validator.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2995 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-26 19:28:55 +00:00
Adrian Holovaty dc378e8ca7 Improved error message if DATABASE_ENGINE is invalid.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2994 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-26 19:02:23 +00:00
Adrian Holovaty 8e9833f261 Fixed #1673 -- Every database backend now raises ImproperlyConfigured if the relevant Python database module raises ImportError
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2993 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-26 18:58:46 +00:00
Luke Plant 0c8ac0972c Made negative indexing on QuerySet instances raise an assertion error (previously
it just returned incorrect results).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@2992 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-26 18:41:03 +00:00
Adrian Holovaty cac7675f24 Added half of oracle backend. (The other half is all of the special-casing in django/db/models/query.py, which I will be refactoring.) Refs #1990. Thanks, Jason Huggins and tzellman
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2986 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-26 05:37:21 +00:00
Luke Plant a666b98783 Fixed bug with Meta.ordering being ignored when slicing a single item off a QuerySet. Thanks, Gábor Fawkes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2970 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-23 19:55:30 +00:00
Malcolm Tredinnick e57e06d40b Fixed #1901 -- removed typos from calls to _get_image_dimensions and
_get_FIELD_filename. Thanks to tom@jerakeen.org for the patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@2947 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-19 09:41:40 +00:00
Adrian Holovaty 0ed64fe329 Fixed #1904 -- Got postgresql_psycopg2 backend working. Thanks for the patch, germish@gmail.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2934 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-18 03:36:58 +00:00
Adrian Holovaty 88ca662e75 Added postgresql_psycopg2 backend, which is untested, just for a starting point
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2928 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-16 23:27:07 +00:00
Adrian Holovaty aa6b13c96b Fixed #1830 -- MySQL inspectdb now detects tinyint field properly
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2922 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-16 20:41:37 +00:00
Adrian Holovaty 3cef18cb51 Fixed #1884 -- Made django.db.models.options.get_verbose_name smarter. Thanks, Alex Dedul
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2909 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-15 18:50:54 +00:00
Malcolm Tredinnick 785ada1bc8 Fixed #1858 : typo in get_FIELD_size() method. Thanks, tom@jerakeen.org.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2903 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-15 00:15:20 +00:00
Malcolm Tredinnick 1006d6eb06 Fixed #1530 -- make count() respect distinct() on QuerySets. Create some
tests for this as well. Thanks to Adam Endicott for the original patch on which
this is based.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@2902 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-14 23:49:29 +00:00
Adrian Holovaty de3edb74c5 Added Model.__str__() default fallback, and changed Model.__repr__() to embed Model.__str__() within it
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2893 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-10 16:10:07 +00:00
Adrian Holovaty 05fd735afe Fixed #1797 -- Fixed NameError in ado_mssql backend. Thanks, pb
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2873 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-09 15:45:09 +00:00
Adrian Holovaty ad181e21c2 Fixed #1818 -- Added better error message for FieldDoesNotExist error. Thanks, Christopher Lenz
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2870 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-09 15:29:53 +00:00
Luke Plant d09ae12632 Removed unused code.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2860 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-06 18:47:28 +00:00
Luke Plant 7a62bac56e Made QuerySet slicing return IndexError instead of DoesNotExist (and related changes).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2859 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-06 18:46:53 +00:00
Adrian Holovaty 71f4568613 Fixed #1776 -- Fixed bug in DateQuerySet when the field is null. Thanks, Christopher Lenz
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2857 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-06 18:35:51 +00:00
Luke Plant 0b73811e26 Fixed QuerySet __getitem__ corner case so that it throws exceptions consistently
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2856 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-06 12:15:19 +00:00
Adrian Holovaty eb4bbbb6f3 Fixed #1777 -- Fixed bug in date conversion in SQLite backend. Thanks, dart@google.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2851 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-06 03:27:49 +00:00
Luke Plant f57e34e990 Fixed #1579 - added support for 'Q' objects in limit_choices_to.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2850 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-06 00:26:24 +00:00
Adrian Holovaty 775c06a959 Fixed #1729 -- Changed get_FIELD_filename() to return an empty string when field fiel's value is null. Thanks, rhettg@gmail.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2839 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-05 02:59:58 +00:00
Adrian Holovaty 1f57fcac98 Removed ManyToManyRel.singular, which wasn't being used anymore.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2828 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-04 04:59:22 +00:00
Adrian Holovaty 69d6bd7af3 Fixed #1745 -- Accessing many-to-many relationships without a PK value now throws an exception. Thanks, Luke
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2817 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-02 19:51:41 +00:00
Adrian Holovaty f69cf70ed8 MERGED MAGIC-REMOVAL BRANCH TO TRUNK. This change is highly backwards-incompatible. Please read http://code.djangoproject.com/wiki/RemovingTheMagic for upgrade instructions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-02 01:31:56 +00:00