Commit Graph

103 Commits

Author SHA1 Message Date
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 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
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 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
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
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
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 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
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
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 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 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 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 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
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
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 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
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
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 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
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
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 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
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 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 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
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 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
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
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
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
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
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
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
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 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
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 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