summaryrefslogtreecommitdiff
path: root/django/newforms/forms.py
AgeCommit message (Collapse)Author
2008-07-19Fixed #7741: django.newforms is now django.forms. This is obviously a ↵Jacob Kaplan-Moss
backwards-incompatible change. There's a warning upon import of django.newforms itself, but deeper imports will raise errors. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7971 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-18Merged the newforms-admin branch into trunk.Brian Rosner
This is a backward incompatible change. The admin contrib app has been refactored. The newforms module has several improvements including FormSets and Media definitions. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-06Fixed #7621 -- Enable superclassing of the various metaclasses we use.Malcolm Tredinnick
Also tidy up some initialisation code in django.db.models.base.ModelBase. Thanks, Christian Tanzer. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7846 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-29Fixed #5811 -- Added an explicit conversion to unicode that was otherwise ↵Malcolm Tredinnick
causing problems in some cases. Thanks, Mike Maravillo. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7186 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-14Modified [7112] to make things behave more in line with Python subclassing ↵Malcolm Tredinnick
when subclassing ModelForms. Meta can now be subclassed and changes on the child model affect the fields list. Also removed a block of error checking, since it's harder to mess up in unexpected ways now (e.g. you can't change the model and get the entirely wrong fields list), so it was a level of overkill. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7115 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-14Fixed #6337. Refs #3632 -- Fixed ModelForms subclassing, to the extent that ↵Malcolm Tredinnick
it can be made to work. This ended up being an almost complete rewrite of ModelForms.__new__, but should be backwards compatible (although the text of one error message has changed, which is only user visible and only if you pass in invalid code). Documentation updated, also. This started out as a patch from semenov (many thanks!), but by the time all the problems were hammered out, little of the original was left. Still, it was a good starting point. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7112 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-17Fixed #6302. FileField no longer requires a value if one already exists. ↵Joseph Kocherhans
Thanks Brian Rosner and Øyvind Saltvik. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7021 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-14Implemented auto-escaping of variable output in templates. Fully ↵Malcolm Tredinnick
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-11Fixed #5918 -- Removed `SortedDictFromList` since `SortedDict` now can do ↵Gary Wilson Jr
everything `SortedDictFromList` could do. Since `SortedDict`'s `copy` method doesn't return a deepcopy as `SortedDictFromList`'s `copy` method did, you will need to update your code if you were relying on `SortedDictFromList.copy` to return a deepcopy by using the `deepcopy` function from the `copy` module. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6668 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-16Fixed #4975 -- Allow the default label suffix character to be configured. ↵Malcolm Tredinnick
Thanks, Vincent Foley. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6352 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-15Fixed #5387 -- Added is_multipart method to forms. Original patch from Petr ↵Malcolm Tredinnick
Marhhoun. Tests and documentation from Murkt. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6273 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14Fixed #3489 -- Added proper deepcopying to form fields so that widget ↵Malcolm Tredinnick
instances get copied as well. Patch from Jonathan Buchanan and insin. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6156 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-13Fixed #4752 -- Make default ErrorList customisable in newforms display. ↵Malcolm Tredinnick
Based on a patch from michal@logix.cz and SmileyChris. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6142 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-06Fixed #3297 -- Implemented FileField and ImageField for newforms. Thanks to ↵Russell Keith-Magee
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-01Fixed #4228 -- Removed hardcoding of `RadioFieldRenderer` in the ↵Gary Wilson Jr
`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-07-04Merged Unicode branch into trunk (r4952:5608). This should be fullyMalcolm Tredinnick
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-06-23Fixed #4527 -- Changed the way errors are displayed in Form.as_p() to avoidMalcolm Tredinnick
invalid XHTML constructs. Based on a patch from SmileyChris. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5518 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-26Fixed #3718 -- Exposed form errors to cleaning methods as soon as they areMalcolm Tredinnick
available. Patch from Gary Wilson. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5348 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-26Fixed #4297 -- Made form errors available to sub-classes. Thanks, Gary Wilson.Malcolm Tredinnick
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5347 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-26Fixed #4390, #4385 -- Made it clear that cleaned_data wasn't being assigned toMalcolm Tredinnick
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-16Fixed #4318 -- Fixed unused imports and other various style tweaks in ↵Adrian Holovaty
newforms. Thanks, Gary Wilson git-svn-id: http://code.djangoproject.com/svn/django/trunk@5263 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-14Changed the fix from [5231] so that the backwards-incompatibility is made moreMalcolm Tredinnick
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-14Renamed form-specific cleaning methods to be do_clean_*, rather than clean_*.Malcolm Tredinnick
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-12Fixed #4018 -- Added code to allow callables as initial data in newforms. ↵Russell Keith-Magee
Thanks for the patch, David Danier. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5209 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-27Fixed #3698 -- Modified newforms labels to only add a colon if the label ↵Russell Keith-Magee
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-26Fixed #4040 -- Changed uses of has_key() to "in". Slight performanceMalcolm Tredinnick
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-04Cleaned up [4924]. Sorry; wasn't concentrating enough.Malcolm Tredinnick
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4925 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-04Fixed #3597 -- Fixed unicode encoding problem in form rendering. Thanks,Malcolm Tredinnick
Georgi Stanojevski and Ville Säävuori. git-svn-id: http://code.djangoproject.com/svn/django/trunk@4924 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-04Moved smart_unicode and StrAndUnicode to django.utils.encoding. They are usefulMalcolm Tredinnick
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-02-19Fixed #3510 -- newforms validation errors are now HTML-escaped for HTML ↵Adrian Holovaty
output. Thanks, scott@staplefish.com git-svn-id: http://code.djangoproject.com/svn/django/trunk@4544 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-15Fixed #3506 -- Changed newforms BoundField.help_text to an empty string if ↵Adrian Holovaty
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-15Fixed #3456 -- Made it easier/more intuitive to render newforms help_text in ↵Adrian Holovaty
templates git-svn-id: http://code.djangoproject.com/svn/django/trunk@4521 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-15Added empty space in newforms BaseForm.__init__() to visually group a ↵Adrian Holovaty
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-14Implemented subclassing Forms in newformsAdrian Holovaty
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4506 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-13Fixed #3489 -- Changed newforms to use copy.copy() in constructing ↵Adrian Holovaty
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-01-28Fixed #3255 -- Added help_text argument to newforms Field class.Adrian Holovaty
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4440 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-27Fixed #3334 -- Changed newforms Form class construction so that appending to ↵Adrian Holovaty
(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-20newforms: Moved flatatt function from widgets.py to util.pyAdrian Holovaty
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4370 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-20newforms: Added attrs optional argument to BoundForm.label_tag()Adrian Holovaty
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4369 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-10Fixed #3278 -- newforms: Fixed bug in DeclarativeFieldsMetaclass where it ↵Adrian Holovaty
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-09Fixed #3193 -- newforms: Modified as_hidden() to handle MultipleChoiceField ↵Adrian Holovaty
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-09newforms: Added 'initial' parameter to Form, which lets initial data be ↵Adrian Holovaty
specified dynamically git-svn-id: http://code.djangoproject.com/svn/django/trunk@4297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-09newforms: Fixed Unicode issue on Python 2.3 when a BoundField's ↵Adrian Holovaty
__unicode__() included non-ASCII characters. Thanks for reporting the error, Johannes Froehlich git-svn-id: http://code.djangoproject.com/svn/django/trunk@4296 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-05newforms: Changed Form.ignore_errors to Form.is_bound, which is more ↵Adrian Holovaty
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-04newforms: Changed Form so that clean_data only exists if a Form is valid. ↵Adrian Holovaty
Thanks for the idea, Honza Kral git-svn-id: http://code.djangoproject.com/svn/django/trunk@4284 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-28newforms: Added 'initial' parameter to Field. This allows you to specify ↵Adrian Holovaty
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-26newforms: A label can now be the empty string, in which case a label won't ↵Adrian Holovaty
be displayed git-svn-id: http://code.djangoproject.com/svn/django/trunk@4240 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-26newforms: Changed Form.as_table() to display errors in same <td> as the fieldAdrian Holovaty
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4239 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-24newforms: Removed Widget.requires_data_list parameter, which was made ↵Adrian Holovaty
redundant by Widget.value_from_datadict() git-svn-id: http://code.djangoproject.com/svn/django/trunk@4235 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-17newforms: Added BaseForm to django.newforms namespaceAdrian Holovaty
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4219 bcc190cf-cafb-0310-a4f2-bffc1f526a37