Commit Graph

281 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
Malcolm Tredinnick 534c0d8442 Fixed #4316 -- Added docstring and tests for django.newforms.utils.flatatt().
Thanks, Gary Wilson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5291 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-19 18:49:35 +00:00
Malcolm Tredinnick b996e214c0 Changed the fix from [5231] so that the backwards-incompatibility is made more
obvious and everything still has nice names.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5237 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-14 16:24:51 +00:00
Malcolm Tredinnick f15036ae6d Renamed form-specific cleaning methods to be do_clean_*, rather than clean_*.
This avoids a name clash that would occur when you had a form field called
"data" (because clean_data is already a dictionary on the Form class).

Backwards incompatible change.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5231 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-14 14:02:36 +00:00
Adrian Holovaty 2c86d57284 Added unit tests and docs for the newforms case in which the form's data doesn't include a value for a nonrequired field
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5218 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-14 02:57:42 +00:00
Russell Keith-Magee 2345029d0d Fixed #4018 -- Added code to allow callables as initial data in newforms. Thanks for the patch, David Danier.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5209 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-12 15:50:32 +00:00
Russell Keith-Magee ca5e12b4ee Removed unit tests added in [5196]; didn't notice the tests in modeltests/model_forms.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5201 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-12 12:22:50 +00:00
Russell Keith-Magee 1bb3ed7264 Added unit tests for form_for_model and form_for_instance.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5196 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-12 04:19:21 +00:00
Malcolm Tredinnick 0b2f9e89cd Fixed #3946 -- Added Swiss localflavor. Thanks, charly.wilhelm@gmail.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5132 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-01 03:10:10 +00:00
Russell Keith-Magee 8a4a8023d6 Fixed #3698 -- Modified newforms labels to only add a colon if the label text doesn't end with punctuation. Thanks, SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5112 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-27 14:27:07 +00:00
Malcolm Tredinnick 592f1280f6 Added tests for Brazilian CRPF field that were accidentally omitted in [5089].
Refs #3957.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5108 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-27 12:50:24 +00:00
Adrian Holovaty 51e867a2e5 Fixed inconsistent period usage in localflavor.br error messages from [5089]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5099 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-26 15:05:47 +00:00
Malcolm Tredinnick 6c02565e4f Fixed #3957, #3945 -- Added CPF and CNPJ (some Brazilian identity numbers)
fields to the Brazilian localflavor. Thanks, onaiort@gmail.com and
danielvaz@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5089 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-26 13:11:07 +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 ed60b8645f Fixed #4122 -- Added Chilean localflavor. Thanks, marijn@metronomo.cl.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5087 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-26 12:41:34 +00:00
Malcolm Tredinnick a738f3a4ff Fixed #4143 -- Added Icelandic localflavor. Note that we use the is_/ directory
name because "is" is a reserved word in Python. Patch from
django@einaregilsson.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5080 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-26 08:43:25 +00:00
Russell Keith-Magee 56b8914eb9 Fixed #3870, Refs #3787 -- Fixed handling of widget attributes on RadioSelect and MultiWidget. In particular, handling of the id attribute has been fixed. Thanks to Gary Wilson and Max Derkachev.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5065 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-24 12:53:29 +00:00
Russell Keith-Magee e9b66ce1d3 Fixed #3866 -- Added Italian Social Security and VAT input fields to localflavor. Thanks, Massimiliano Ravelli.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5018 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-17 13:37:45 +00:00
Adrian Holovaty 247bed848f Fixed #3983 -- Fixed misspelled Delaware in localflavor unit tests
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4993 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-10 21:11:08 +00:00
Adrian Holovaty e34e433641 Fixed #3929 -- Newforms Textarea widget now always includes 'rows' and 'cols' attributes, even if you don't pass them in, for HTML correctness. Thanks, and welcome back, Luke Plant
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4961 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-09 01:22:45 +00:00
Russell Keith-Magee 8fafee4de0 Fixed #3876 -- Added Australian local flavour. Thanks, Matthew Flanagan.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4955 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-08 13:22:48 +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
Adrian Holovaty e3308e1976 Fixed inconsistent indentation in localflavor/de/forms.py from [4922]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4939 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-06 04:24:06 +00:00
Malcolm Tredinnick b30c505d0d Fixed #3931 -- Corrected a typo noticed by Jorge Gajon.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4930 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-05 03:13:17 +00:00
Malcolm Tredinnick 5f7b0dfb11 Removed an umlaut, since our i18n support (creating PO files) doesn't work
smoothly with Python unicode strings at the moment.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4926 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-04 15:15:51 +00:00
Malcolm Tredinnick f529a1f12e Fixed #3597 -- Fixed unicode encoding problem in form rendering. Thanks,
Georgi Stanojevski and Ville Säävuori.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4924 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-04 13:52:35 +00:00
Malcolm Tredinnick 5f2c513f9c Fixed #3919 -- Added German identity card number validation to German
localflavor. Thanks, Jannis Leidel.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4922 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-04 11:40:08 +00:00
Malcolm Tredinnick 7a0441b712 Fixed #3897 -- Added German localflavor. Thanks, Jannis Leidel.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4920 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-04 06:45:29 +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
Adrian Holovaty f791a598a8 Negligible formatting changes to some recent commits
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4917 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-03 22:33:28 +00:00
Malcolm Tredinnick a5938f350c Fixed #3890 -- Added USSocialSecurityNumberField. Thanks James Bennet.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4910 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-03 03:56:17 +00:00
Malcolm Tredinnick 44ba9aa674 Fixed #3882 -- Changed error messages in Brazilian localflavor to be in
English. Thanks, Wiliam Alves de Souza.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4908 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-03 03:13:21 +00:00
Malcolm Tredinnick 4a3db287f1 Fixed #3600 -- Made smart_unicode respect deferred evaluation in the case
of strings translated with gettext_lazy and friends.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4904 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-02 10:53:05 +00:00
Malcolm Tredinnick c60587b5a7 Fixed #3810 -- In newforms, copy attribute dictionaries before modifying them
in place.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4894 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-01 05:26:26 +00:00
Malcolm Tredinnick b11454dc3d Moved localflavor form tests into their own file.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4887 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-01 04:40:36 +00:00
Malcolm Tredinnick 5787603c8b Fixed #3866 -- Added tests for localflavor/it. Thanks flavio.curella@gmail.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4876 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-31 09:18:20 +00:00
Malcolm Tredinnick 79312f7a4e Fixed #3882 -- Added Brazilian localflavor. Thanks, Wiliam Alves de Souza.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4874 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-31 09:05:54 +00:00
Malcolm Tredinnick 63a629bb8d Fixed #3847 -- Added validation support for Finnish social security numbers.
Thanks, karsu.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4868 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-30 10:18:15 +00:00
Malcolm Tredinnick 51c7dadc4c Fixed #3847 -- Added Finnish localflavor contribution from Ville Säävuori.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4867 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-30 10:04:22 +00:00
Adrian Holovaty f2861dad43 Fixed #3715 -- Added Japanese package to django.contrib.localflavor. Thanks, Makoto Tsuyuki
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4822 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-25 21:26:44 +00:00
Adrian Holovaty 955f4db6f4 Fixed #3813 -- Added French package to django.contrib.localflavor. Thanks, Fabrice Aneche
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4820 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-25 21:10:36 +00:00
Malcolm Tredinnick f309bde7f6 Fixed #3654 -- Fixed test failure from [4665].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4666 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-06 01:12:46 +00:00
Adrian Holovaty 08e406d146 Added newforms USPhoneNumberField in django.contrib.localflavor.usa
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4554 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-21 05:54:09 +00:00
Adrian Holovaty 5bec651a61 Added small newforms unit test
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4551 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-21 03:47:03 +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 907241e299 Fixed #2455 -- Added newforms USStateSelect widget in django.contrib.localflavor.usa
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4545 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-20 00:30:22 +00:00
Adrian Holovaty b8fa80bd00 Fixed #3510 -- newforms validation errors are now HTML-escaped for HTML output. Thanks, scott@staplefish.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4544 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-19 23:54:55 +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 4a85a75fb0 Fixed #3506 -- Changed newforms BoundField.help_text to an empty string if None. Thanks for the patch, Thomas Steinacher
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4528 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-15 22:43:43 +00:00
Adrian Holovaty 1d5e974a4f Fixed #3503 -- Added newforms UKPostcodeField in django.contrib.localflavor.uk. Thanks for the patch, Jonathan Buchanan
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4527 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-15 21:26:43 +00:00
Adrian Holovaty 1ce1442d95 Implented newforms USStateField in django.contrib.localflavor.usa. Refs #2455
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4525 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-15 06:18:27 +00:00
Adrian Holovaty 27b28616b4 Created django.contrib.localflavor, for country- and culture-specific functionality. Moved django/newforms/extras/usa.py into there
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4524 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-15 05:53:44 +00:00
Adrian Holovaty b93614ada6 Fixed #3409 -- Added render_value argument to newforms PasswordInput. Thanks for the patch, scott@staplefish.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4523 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-15 05:05:43 +00:00
Adrian Holovaty a13a47e447 Fixed #3314 -- Fixed a bug in newforms smart_unicode. Thanks for the patch, nesh
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4522 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-15 04:13:02 +00:00
Adrian Holovaty 6245816dd9 Fixed #3456 -- Made it easier/more intuitive to render newforms help_text in templates
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4521 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-15 04:03:47 +00:00
Adrian Holovaty 2ec2bf6989 Fixed #1466 -- Added newforms USZipCodeField
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4519 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-15 03:37:25 +00:00
Adrian Holovaty 0518205308 Implemented subclassing Forms in newforms
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4506 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-14 23:44:46 +00:00
Adrian Holovaty 9efa60dafb Fixed #3489 -- Changed newforms to use copy.copy() in constructing self.fields, so changes to self.fields in a given form instance do not affect other instances
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4504 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-13 18:04:47 +00:00
Malcolm Tredinnick ea7b3fd148 Fixed #3449 -- fixed regression test results so that they all pass now. Thanks
Brian Harring.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4466 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-09 22:09:07 +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 546f16d323 newforms: Added a unit test that tests dynamic field addition with base fields defined on the class
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4438 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-27 22:16:16 +00:00
Adrian Holovaty c93686c698 Fixed #3334 -- Changed newforms Form class construction so that appending to (or altering) self.fields affects only the instance, not the class. As a consequence, self.fields is created in Form.__init__(). The form metaclass now creates a variable self.base_fields instead of self.fields.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4437 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-27 22:06:56 +00:00
Adrian Holovaty c0e01416b6 Fixed #3312 -- CheckboxSelectMultiple no longer uses duplicate ID attributes for each checkbox
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4436 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-27 21:41:32 +00:00
Adrian Holovaty 982a9443e1 Fixed #3300 -- Changed newforms Select widget to collapse 'choices' into a list if it's an iterable, so the iterable can be iterated over multiple times.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4435 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-27 21:30:26 +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 a154d94e45 newforms: Added attrs optional argument to BoundForm.label_tag()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4369 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-20 20:31:17 +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 a0137c41f3 Fixed #3289 -- newforms: Added value_from_datadict method to MultipleHiddenInput
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4311 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-13 04:51:57 +00:00
Adrian Holovaty 663ef14f02 newforms: Added unit tests for MultipleHiddenInput
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4310 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-13 04:43:34 +00:00
Adrian Holovaty 73d62743e9 newforms: Added unit tests and docs explaining that clean_data will only ever contain fields of the form, even if extra fields are passed in data
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4306 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-11 00:04:27 +00:00
Adrian Holovaty fa38ce7207 Fixed #3266 -- newforms: Made RadioSelect accept funky characters. Thanks for reporting, Honza Kral
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4304 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-10 23:25:29 +00:00
Adrian Holovaty f6a7002ef1 Fixed #3278 -- newforms: Fixed bug in DeclarativeFieldsMetaclass where it inadvertently overrode the class' name. Thanks, russblau@imapmail.org
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4303 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-10 22:46:06 +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 2e148d7064 newforms: Added 'initial' parameter to Form, which lets initial data be specified dynamically
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-09 04:39:44 +00:00
Adrian Holovaty 02f690f738 newforms: Changed Form.ignore_errors to Form.is_bound, which is more descriptive and can be helpful to access at runtime
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4286 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-05 00:04:38 +00:00
Adrian Holovaty b1f6b376c0 newforms: Changed Form so that clean_data only exists if a Form is valid. Thanks for the idea, Honza Kral
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4284 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-04 06:25:53 +00:00
Russell Keith-Magee eecd90f5c2 Fixed problem with SelectDateWidget test caused by 2006/2007 year rollover. Thanks, Robert Myers.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4272 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-03 03:58:11 +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 d0fcef9db0 newforms: A label can now be the empty string, in which case a label won't be displayed
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4240 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-26 23:33:20 +00:00
Adrian Holovaty 30c2bffe17 newforms: Changed Form.as_table() to display errors in same <td> as the field
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4239 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-26 23:16:16 +00:00
Adrian Holovaty 247fdc19ad newforms: Implemented RadioFieldRenderer.__getitem__(), which allows for index lookup on radio fields
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4238 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-26 22:56:53 +00:00
Adrian Holovaty 86870e7587 newforms: Added django.newforms.extras.widgets, with SelectDateWidget implementation, plus some unit tests
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4236 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-24 20:22:38 +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 d8a21981b7 Fixed #3139 -- newforms BoundField no longer returns empty errors when using a prefix. Thanks, jkocherhans
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4199 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-13 23:03:19 +00:00
Adrian Holovaty 6733c39804 Fixed #3112 -- Changed newforms Form.as_table() to use <th> instead of <td> for first column
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4197 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-13 06:44:57 +00:00
Adrian Holovaty 4add4e4272 Fixed #3114 -- newforms MultipleChoiceField now handles MultiValueDicts properly. Thanks for the patch, Honza Král
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4196 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-13 06:26:04 +00:00
Adrian Holovaty faaec9c28f Fixed #3132 -- Added prefix support for newforms. Thanks, jkocherhans
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4194 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-12 05:55:39 +00:00
Adrian Holovaty 05588b3797 newforms: Changed Form to use auto_id by default
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4192 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-11 02:38:18 +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 7e269bd390 Fixed #3107 -- newforms: Added Form.as_p()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4178 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-07 06:34:37 +00:00
Adrian Holovaty 44add112e5 newforms: Form.as_ul() no longer puts hidden fields between <li>s. Similar to [4175], which was the same thing for Form.as_table(). Refs #3101
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4177 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-07 06:17:06 +00:00
Adrian Holovaty 300f26deff Fixed #3101 -- newforms: Form.as_table() no longer puts hidden fields between <tr>s. Thanks for reporting, Eric
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4175 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-07 06:06:58 +00:00
Adrian Holovaty 12e9a84429 newforms: Changed Table.as_table() and Table.as_ul() to put hidden-form errors at the top of the output rather than in field order
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4173 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-07 05:35:39 +00:00
Adrian Holovaty 468993d13e newforms: Added check_test argument to CheckboxInput and changed its render() behavior slightly. Also changed CheckboxSelectMultiple to use checkboxes with the same name, rather than checkboxes with separate names
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4148 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-30 22:06:08 +00:00
Adrian Holovaty 89d1270e51 newforms: Added some more documentation to unit tests
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4147 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-30 17:48:54 +00:00
Adrian Holovaty e130031fd2 Fixed #3082 -- newforms: Changed Form as_table() and as_ul() not to display verbose names for hidden fields, and to add field-name prefix to error messages to avoid user confusion. Also added unit tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4146 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-30 17:07:40 +00:00
Adrian Holovaty 4dca65cdfc newforms: Added BoundField.as_hidden()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4145 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-30 03:58:25 +00:00
Adrian Holovaty 61c93842f4 newforms: Added BoundField.data property
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4143 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-29 21:48:58 +00:00
Adrian Holovaty 4a3ad338d6 newforms: Added Widget.value_from_datadict hook, which allows a Widget to define how to convert its post data dictionary to a value. Implemented it for CheckboxSelectMultiple and updated unit tests
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4136 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-29 17:00:34 +00:00
Adrian Holovaty 8aae90c0e5 newforms: Implemented CheckboxSelectMultiple
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4132 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-29 03:02:26 +00:00
Adrian Holovaty fe4af48ec8 newforms: The <input> tags in a RadioSelect now each have a distinct ID. Also, this plays nicely with auto_id and <label>s for Form.as_table() and Form.as_ul(). Refs #3064
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4131 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-29 01:40:27 +00:00
Adrian Holovaty bb45c394a6 Fixed #3064 -- newforms: Added <label> support through BoundField.label_tag() method. Also added BoundField.verbose_name and added/updated unit tests. Thanks, SmileyChris
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4130 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-29 00:49:27 +00:00
Adrian Holovaty 3d89f26b08 newforms: Changed Form unit tests to use f.clean_data rather than f.clean(), because the latter is a validation hook, not a way to get the clean data
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4129 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-28 23:14:18 +00:00
Adrian Holovaty 190c987e63 newforms: Normalized all error <ul>s to use class='errorlist'
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4120 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-27 04:56:33 +00:00
Adrian Holovaty 49236b95e9 newforms: Added Form.non_field_errors() and added more examples/documentation to the unit tests
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4119 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-27 04:49:26 +00:00
Adrian Holovaty 126e0ec0c3 Fixed #3026 -- newforms: Form class now suppresses validation and errors if no data (or None) is passed in. Validation still happens if you pass in an empty dictionary. Also updated unit tests. Thanks, SmileyChris
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4117 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-27 03:49:19 +00:00
Adrian Holovaty 682e435c5f newforms: Changed Form.errors to be a property rather than a function. Refs #3026
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4116 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-27 01:55:24 +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 4a14f2e233 Fixed #3065 -- newforms: Fixed rendering problem with RadioSelect as a member of a Form. Also fixed some Unicode issues and added unit tests. Thanks for reporting, Derek Hoy
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4106 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-26 18:44:58 +00:00
Adrian Holovaty 5836b140fa newforms: Added unit test to test field order. Refs #3054
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4092 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-23 17:16:15 +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 75516392b8 newforms: Fixed #3027 -- Changed Form as_table(), as_ul(), as_table_with_errors() and as_ul_with_errors() to exclude <table> and <ul>. Good idea, SmileyChris
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4075 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-16 01:16:33 +00:00
Adrian Holovaty 05420093ae newforms: Added unit test showing it's possible to construct the fields in a Form dynamically
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4074 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-15 23:17:00 +00:00
Adrian Holovaty c4070e86c8 Fixed #3025 -- Added auto_id option to Form.__init__(). Thanks, SmileyChris
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4073 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-15 23:09:10 +00:00
Adrian Holovaty 522f674070 newforms: Implemented RadioSelect, with unit tests
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4072 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-15 22:08:22 +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 36786d28f5 Implemented SelectMultiple in django.newforms.widgets
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3958 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-02 01:06:12 +00:00
Adrian Holovaty 964ccd1023 Updated forms unit tests to reflect new fields and widgets from [3955] and [3956]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3957 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-01 23:54:17 +00:00
Adrian Holovaty bcba29fcd6 Changed forms unit tests to reflect the fact that render() does not use the to_python() value of data
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3946 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-10-28 20:59:23 +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