Commit Graph

134 Commits

Author SHA1 Message Date
Malcolm Tredinnick e9814029f5 Fixed #10692 -- Fixed DecimalField lookups for extreme values.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10545 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-12 05:32:23 +00:00
Malcolm Tredinnick a584a6b40f Fixed #10071 -- Changed some internal database data representations.
We now pass numbers used in data queries as actualy numbers (integers) to the
database backends, rather than string forms. This is easier for some of the
less flexible backeds.

Based on a patch from Leo Soto and Ramiro Morales.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10530 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-12 02:00:58 +00:00
Ian Kelly e07a3a278e Fixed BooleanFields being coerced null=True in Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10505 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-11 00:06:53 +00:00
Jacob Kaplan-Moss a34b718192 Fixed #9640, #10549: BooleanFields with choices, a default, and null=False now correctly doesn't generate a blank option.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10500 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-10 19:54:31 +00:00
Malcolm Tredinnick 0516c5d921 Fixed #10443 -- Fixed model attribute updating after r10003.
Adding a get_db_prep_save() call to the UpdateQuery code path meant it
was being called twice if you updated an existing model attribute. This
change removes that double call and also makes TimeField.to_python() a
little more robust for the benefit of the Oracle backend (just in case).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10013 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-10 05:24:19 +00:00
Malcolm Tredinnick c7a1a9f380 Changed the handling of as_sql() versus _as_sql() in Query/QuerySet from r9928.
This avoids inadvertently hiding AttributeError that is raised for other
reasons.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9965 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-04 04:56:20 +00:00
Malcolm Tredinnick 3242df16e4 To avoid an unfortunately common user-error, rename QuerySet.as_sql().
This was never a public API method, so this is backwards compatible, unless
you're poking at the internals. Refs #10352.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9928 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-01 04:12:30 +00:00
Karen Tracey addd3df3bd Fixed #7672 -- Added a 'week_day' lookup type. Many thanks to Ross Poulton for the proposal and implementation on all built-in database backends..
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9818 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-08 05:08:06 +00:00
Russell Keith-Magee cf37e4624a Fixed #7210 -- Added F() expressions to query language. See the documentation for details on usage.
Many thanks to:
    * Nicolas Lara, who worked on this feature during the 2008 Google Summer of Code.
    * Alex Gaynor for his help debugging and fixing a number of issues.
    * Malcolm Tredinnick for his invaluable review notes.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9792 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-29 10:46:36 +00:00
Russell Keith-Magee 096a9ecc5c Fixed #9942 -- Added a to_python handler for FloatField to ensure correct typing of deserialized data before saving. Underlying problem is analogous to #8298, fixed in [8515]. Thanks to David Larlet <larlet@gmail.com> for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9695 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-03 04:43:58 +00:00
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 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
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
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
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 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
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
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
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
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
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
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
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 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
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
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
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