Commit Graph

143 Commits

Author SHA1 Message Date
Malcolm Tredinnick 1c42c7cade Fixed #4297 -- Made form errors available to sub-classes. Thanks, Gary Wilson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5347 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-26 08:53:22 +00:00
Malcolm Tredinnick 198127a0f2 Fixed #4390, #4385 -- Made it clear that cleaned_data wasn't being assigned to
twice without reason. Also make sure that if field specific clean functions
fail, the form-wide field cleaning is removed from cleaned_data.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5346 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-26 08:47:15 +00:00
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
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
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
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 6aa5091d58 Added docs for form_for_model and form_for_instance, and added a fields argument so it is easy to create forms from a subset of model fields.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5202 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-12 14:42:46 +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 439cb4047f Fixed #4040 -- Changed uses of has_key() to "in". Slight performance
improvement and forward-compatible with future Python releases. Patch from Gary
Wilson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-26 13:30:48 +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
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
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
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
Malcolm Tredinnick bc65445e8d Cleaned up [4924]. Sorry; wasn't concentrating enough.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4925 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-04 13:57:14 +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 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 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 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
Malcolm Tredinnick 6a5deb6bc0 Fixed #3635 -- Fixed KeyError problem in newforms.model.save_instance().
Thanks, ludo@qix.it.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4878 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-31 09:47:32 +00:00
Adrian Holovaty e8f165f1f0 Added a comment to ModelChoiceField from [4552]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4553 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-21 05:18:34 +00:00
Adrian Holovaty ee96c7eb2d Fixed #3534 -- newforms ModelChoiceField and ModelMultipleChoiceField no longer cache choices. Instead, they calculate choices via a fresh database query each time the widget is rendered and clean() is called
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4552 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-21 05:14:28 +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 bdfbcb2cd5 Fixed #3247 -- newforms form_for_model() and form_for_instance() no longer create form fields for database fields with editable=False. Thanks for the patch, mssnlayam@yahoo.com and Philipp Keller
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4548 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-20 02:59:16 +00:00
Adrian Holovaty e56934b9b9 Fixed #3257 -- Added newforms ModelChoiceField and ModelMultipleChoiceField, which are now used by form_for_model() and form_for_instance(). Thanks for the patch, Honza Kral, floguy@gmail.com and kilian.cavalotti
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4547 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-20 02:42:07 +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 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 41078ce146 Added empty space in newforms BaseForm.__init__() to visually group a lengthy comment with the code that it's commenting
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4520 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-15 03:46:43 +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
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 5aea495ac3 Improved newforms.models.save_for_instance() to set many-to-many values via ID instead of instance, to save on a database query, thanks to [4448]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4449 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-29 16:12:17 +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 83768bf067 Fixed #3263 -- newforms form_for_model() and form_for_instance() now handle foreign-key and many-to-many data properly. Thanks for the patch, Jeff Hilyard
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4439 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-28 04:56:54 +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 af377b13e1 newforms: Added formfield_callback argument to form_for_model and form_for_instance. The admin reworking will need this hook.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4387 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-22 06:10:47 +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