Commit Graph

40 Commits

Author SHA1 Message Date
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
Adrian Holovaty 4868af8a57 Fixed #4318 -- Fixed unused imports and other various style tweaks in newforms. Thanks, Gary Wilson
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5263 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-16 21:20:35 +00:00
Russell Keith-Magee b24c860fa2 Fixed #3787, #3788 -- Corrected check for IndexError on MultiValueField, and fixed the value_from_datadict method for MultiWidgets to handle Multiwidgets containing Multiwidgets. Also added a testcase walking through the use of MultiWidget/MultiValueField. Thanks to Max Derkachev for reporting these issues and providing fixes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5088 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-26 12:46:04 +00:00
Malcolm Tredinnick 15d5c3decb Fixed #3821 -- Added a widget class attribute to ChoiceField and
MultipleChoiceField. This makes them consistent with other field classes and
make subclassing easier. This is a backwards compatible change. Thanks, Max
Dekachev.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5053 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-21 05:43:32 +00:00
Malcolm Tredinnick 1bddac37b6 Moved smart_unicode and StrAndUnicode to django.utils.encoding. They are useful
outside of newforms. This is backwards compatible as far as smart_unicode goes
(since newforms.util still imports it). All imports of smart_unicode and
StrAndUnicode have also been updated.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4918 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-04 06:34:19 +00:00
Malcolm Tredinnick 4552175d44 Tweaked formatting so that comments are readable on 80-char terminals.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4889 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-01 05:05:59 +00:00
Adrian Holovaty a52cc03374 Fixed #3490 -- Fixed issue with newforms ChoiceField and generators as choices. Thanksfor the patch, Chris.Wesseling@cwi.nl
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4549 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-20 03:05:09 +00:00
Adrian Holovaty 7cb7541971 Improved newforms to handle wacky characters in Field help_text
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4543 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-19 23:43:14 +00:00
Adrian Holovaty 04c4a031ba newforms: Changed ChoiceField error message *not* to include user-provided input
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4460 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-05 21:26:57 +00:00
Adrian Holovaty cf75fcc832 Fixed #3255 -- Added help_text argument to newforms Field class.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4440 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-28 22:10:04 +00:00
Adrian Holovaty 788f8f7454 newforms: Implemented NullBooleanField and NullBooleanSelect
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4411 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-24 05:23:19 +00:00
Adrian Holovaty 8a6c337f2a newforms: Added MultiValueField, SplitDateTimeField, MultiWidget, SplitDateTimeWidget
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4403 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-23 20:23:07 +00:00
Adrian Holovaty 76f6dd42cc Fixed #3196 -- Fixed inconsistency in setting choices on ChoiceFields dynamically
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4379 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-21 01:29:01 +00:00
Adrian Holovaty f073318668 newforms: Fixed confusing behavior when setting choices for ChoiceFields and their corresponding Widgets. Now, a Widget uses the choices from its ChoiceField regardless of whether the Widget has its own choices.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4378 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-21 01:10:55 +00:00
Adrian Holovaty 230b746f6c Fixed #3303 -- Cleaned some newforms clean() method implementations. Thanks for the patch, SmileyChris
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4367 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-20 17:31:45 +00:00
Adrian Holovaty 5e8c1a6c47 Fixed #3337 -- Changed newforms Field subclasses to use super(). Thanks for the patch, Dirk Datzert
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4366 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-20 17:25:42 +00:00
Adrian Holovaty f2a3deb087 Fixed #3281 -- newforms: URLField now works properly with required=False and verify_exists=True together. Thanks, zendak
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4313 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-13 05:19:15 +00:00
Adrian Holovaty 6b31f95516 Fixed #3293 -- newforms: Changed IntegerField.clean() to return None if field is not required and empty. Thanks, Honza Kral
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4312 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-13 05:08:07 +00:00
Adrian Holovaty fb60a6ff0a Fixed #3193 -- newforms: Modified as_hidden() to handle MultipleChoiceField correctly. Thanks for the report, Honza Kral
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4298 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-09 05:12:25 +00:00
Adrian Holovaty 2cb0fe71a2 newforms: Added 'initial' parameter to Field. This allows you to specify initial data that will be displayed with the form if no data is given. Also added unit tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4249 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-28 00:01:52 +00:00
Adrian Holovaty b5cd7d469d newforms: Added max_length and min_length optional arguments to RegexField, EmailField and URLField. Note that the argument order for those three fields has changed
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-26 23:46:10 +00:00
Adrian Holovaty cd394a246a Fixed #3153 -- newforms 'label' argument now can contain wacky characters. Thanks, dswistowski
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-17 19:04:03 +00:00
Adrian Holovaty 546297be27 newforms: Implemented min_value and max_value options for IntegerField
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4218 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-15 23:18:47 +00:00
Adrian Holovaty 26489d4e2a newforms: Fixed unexpected behavior with CharField(required=False, min_length=X). Thanks for reporting, Benjamin Slavin
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4217 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-15 23:07:41 +00:00
Adrian Holovaty fc11b97e97 Fixed #3143 -- Added TimeField to newforms. Thanks, jkocherhans
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4202 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-14 20:35:32 +00:00
Adrian Holovaty d93021eb10 Fixed #3102 -- newforms: Fields can now designate their human-friendly labels. BoundField.verbose_name is now BoundField.label
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4188 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-08 20:06:12 +00:00
Adrian Holovaty f10a910577 newforms: Added Field.widget_attrs() hook, which lets a Field designate HTML attributes to use in its widget. Implemented CharField.widget_attrs(), which sets the HTML maxlength attribute for <input type='text'> and <input type='password'>. Thanks for the idea, Gary Doades
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4187 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-08 18:54:53 +00:00
Adrian Holovaty 4e72dc86ff Fixed small Unicode error in newforms. Thanks, Honza Král. Refs #3114
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4185 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-08 05:54:14 +00:00
Adrian Holovaty e6d19257ba Fixed #3095 -- Added translation strings to newforms. Thanks for the patch, Honza Král
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4166 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-06 06:37:32 +00:00
Adrian Holovaty a794acbd7a newforms: Removed DEFAULT_ENCODING import from fields.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4162 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-05 19:55:51 +00:00
Adrian Holovaty 56ad38a826 newforms: Added a bunch of unit tests and fixed some bugs in the case of required=False for various Field subclasses
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4113 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-27 00:49:26 +00:00
Adrian Holovaty 2e4ff8ee0c Fixed #3038 -- newforms: RegexField no longer validates empty input for required=False. Thanks for reporting, Thomas Steinacher
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4111 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-27 00:23:17 +00:00
Adrian Holovaty 3abf8e42b5 Fixed #3054 -- newforms Form now keeps track of field order
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4093 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-23 17:40:33 +00:00
Adrian Holovaty 6dd4e6d046 newforms: Fixed #3008 -- Widgets now support strings containing utf-8 characters. Thanks for reporting, Nebojša Đorđević
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4076 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-16 06:45:29 +00:00
Adrian Holovaty 6a53c8a2dd Fixed #2997 -- Fixed URLField validation in django.newforms. Thanks, jkocherhans
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4061 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-10 03:39:00 +00:00
Adrian Holovaty a888249770 Implemented [4035] (improvement in URL validation) in django.newforms
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4037 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-07 02:32:33 +00:00
Adrian Holovaty 46b0713315 django.newforms: Implemented hook for validation not tied to a particular field. Renamed to_python() to clean() -- it's just...cleaner. Added Form.as_table(), Form.as_url(), Form.as_table_with_errors() and Form.as_ul_with_errors(). Added ComboField. Updated all unit tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3978 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-04 20:49:59 +00:00
Adrian Holovaty 6645d1fe48 Added ChoiceField, MultipleChoiceField to django.newforms
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3959 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-02 03:16:12 +00:00
Adrian Holovaty c58fe999a1 Added URLField to django.newforms.fields
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3955 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-01 23:52:43 +00:00
Adrian Holovaty 88a2f53b85 Split django.newforms into forms, fields, widgets, util. Also moved unit tests from docstrings to a standalone module in tests/regressiontests/forms, to save docstring memory overhead, keep code readable and fit our exisitng convention
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3945 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-10-28 20:34:37 +00:00