Commit Graph

49 Commits

Author SHA1 Message Date
Malcolm Tredinnick 12ed18935b Fixed #6113 -- Added auto-escaping "safe" marking for the MultiWidget. Thanks, Martin Conte MacDonell.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7083 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-04 02:33:38 +00:00
Malcolm Tredinnick 1c87a7bb58 Fixed #5730: Conditionally escape widget contents in newforms to avoid
inadvertent double-escaping. This still isn't perfect behaviour (since it's
unaware of the current context's auto-escaping setting), but that's a larger
problem that needs fixing and this change at least makes the existing
behaviour consistent. Patch from SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6722 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-28 20:19:54 +00:00
Gary Wilson Jr f110da91db Fixed #5993 -- Made `RadioSelect` easier to subclass by giving it a default `renderer` as a class attribute.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6717 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-26 02:39:48 +00:00
Malcolm Tredinnick 356662cf74 Implemented auto-escaping of variable output in templates. Fully controllable by template authors and it's possible to write filters and templates that simulataneously work in both auto-escaped and non-auto-escaped environments if you need to. Fixed #2359
See documentation in templates.txt and templates_python.txt for how everything
works.

Backwards incompatible if you're inserting raw HTML output via template variables.

Based on an original design from Simon Willison and with debugging help from Michael Radziej.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6671 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-14 12:58:53 +00:00
Malcolm Tredinnick 003b3c1a17 Fixed #5794 -- Be more robust when rendering a DateTimeInput widget. Thanks,
MikeH.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6594 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-22 13:13:12 +00:00
Malcolm Tredinnick c64a6c98c4 Removed unwanted import that snuck into [6578].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6579 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-21 14:57:05 +00:00
Malcolm Tredinnick 1671fc48ab Changed the default form presentation of datetime values to not include the
fractional second values (they usually aren't going to be needed). Based on
patches from yi.codeplayer@gmail.com, andrews and Wiliam Alves de Souza. Fixed #4428, #4487


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6578 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-21 14:50:47 +00:00
Malcolm Tredinnick e38d54e19a Changed newforms.CheckboxInput widget to return False as its value when not
include in the form (since HTML form submission doesn't send unselected check
boxes). Patch from SmileyChris. Refs #5104.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6563 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-20 12:21:07 +00:00
Malcolm Tredinnick 3c18331adc Changed some Widget subclasses to be consistent about how they handle the passed in 'attrs' parameter. We now always copy it (by calling the parent's __init__).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6451 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-04 01:20:27 +00:00
Malcolm Tredinnick b1cc3318c7 Added a __deepcopy__() method to the Widget class in order to avoid a number of easy-to-trigger problems when copying Widget subclasses. Subclasses which are intended to have extra mutable fields should override this method. Refs #5505.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6450 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-04 01:12:00 +00:00
Malcolm Tredinnick f0cd172cd0 Fixed #5387 -- Added is_multipart method to forms. Original patch from Petr Marhhoun. Tests and documentation from Murkt.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6273 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-15 10:12:05 +00:00
Russell Keith-Magee fbd1a6277e Fixed #3297 -- Implemented FileField and ImageField for newforms. Thanks to the many users that contributed to and tested this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5819 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-06 13:58:56 +00:00
Gary Wilson Jr cdbd5751d3 Fixed #4228 -- Removed hardcoding of `RadioFieldRenderer` in the `RadioSelect` Widget so that the display of `RadioSelect`s can be more easily customized. `BoundField.__unicode__` also no longer special cases `RadioSelect` since `RadioSelect.render()` now returns a string like every other Widget.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5782 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-01 05:41:32 +00:00
Malcolm Tredinnick 953badbea5 Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.

Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
Adrian Holovaty acf0ff02e7 Added some clearer docstrings to MultiValueField and MultiWidget
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5575 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-01 04:24:20 +00:00
Malcolm Tredinnick ac64e91a0c Merged boulder-oracle-sprint branch (r3965:5512) back into trunk. All
expected tests pass for all databases.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5519 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-23 14:16:00 +00:00
Malcolm Tredinnick 08aa5c585b Fixed #4607 -- Tweaked checks for features missing in Python 2.3 to not assume
things Python does not guarantee. Patch from SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5514 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-23 03:18:22 +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 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
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 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 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
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 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 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 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 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 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 3d9b12b2d8 newforms: Removed Widget.requires_data_list parameter, which was made redundant by Widget.value_from_datadict()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4235 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-24 03:36:49 +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 6c0219cf72 newforms: Added __unicode__() methods wherever there were __str__() methods, and changed the __str__() methods to delegate to __unicode__().encode(settings.DEFAULT_CHARSET)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4163 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-05 20:08:27 +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 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 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 e6babbfe5f newforms: Added docstring to Widget.build_attrs()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4134 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-29 03:18:56 +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 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 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 5a597d3bbb newforms: Cleaned up some un-DRYness by adding Widget.build_attrs(). Also slightly changed flatatt to include a leading space, so the spaces don't have to be hard-coded each time you embed flatatt() results in HTML. Thanks, SmileyChris. Refs #3023
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4071 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-15 20:16:04 +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 c0eab791df Added PasswordInput, HiddenInput, FileInput, Select to django.newforms.widgets
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3956 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-01 23:53:37 +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