Commit Graph

133 Commits

Author SHA1 Message Date
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
Adrian Holovaty 93eebd95cb newforms: Moved flatatt function from widgets.py to util.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4370 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-20 20:33:23 +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 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 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 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 78b89ff118 Fixed #3232 -- newforms: Added save_instance(), which saves a given bound form's clean_data into a given model instance with the same field names
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4300 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-09 05:49:47 +00:00