Releases: insin/newforms
Releases · insin/newforms
newforms 0.5.0 - first release as a React library
What's New?
newforms now renders by creating React DOM components instead of using DOMBuilder's environment-specific output - React is a much better fit for newforms on the client side as it takes care of keeping the DOM in sync with your generated forms, without having to blow the lot away every time you want to update.
The parts of newforms base functionality which are ported from Django should now be in line with what's on offer in the upcoming Django 1.7 release.
If you were previously using newforms with text-based templates such as Jade in Node,js, stck with v0.4.2 for now...
Breaking Changes
- Now depends on React 0.9.0.
- Newforms components now render by creating React.DOMcomponents instead of
 relying on context-specific output fromDOMBuilder.createElement().
- Components which can be rendered no longer have toString()methods --
 creation of final output is now handled by callingReact.renderComponent
 orReact.renderComponentToStringon a React component which includes
 rendered output of a newforms Form -- this (temporarily) breaks usage of
 newforms in String-based templating libraries such as Jade.
- HTML output has changed -- this will break any tests which depended on the
 specifics of how DOMBuilder generated HTML.- React has no equivalent of a virtual DocumentFragment as yet - there are new
 wrapper elements in various places.
- React wraps free-standing text nodes with <span>.
- Boolean attributes no longer have a value duplicating the attribute name.
 
- React has no equivalent of a virtual DocumentFragment as yet - there are new
- HTML attribute names must now match what React expects -- no more
 'maxlength'or quoted'class'and'for'attributes.
- A String can no longer be used to specify multiple selected items in a
 SelectMultiple-- this used to be an accident based on duck typing of
 index access to both items in an Array and characters in a String. If a
 non-Array is given as the selected value, it will now be wtapped in an Array.
- CheckboxInputno longer silenty swallows any errors thrown by the provided
 - checkTestfunction.
- _hasChangedhas moved from Widgets to Fields.
- The default error message for an invalid email address has changed.
- ValidationErrorAPI changed --- messagesis now a function rather than
 an array of Strings.
- ErrorListAPI changed -- a- messages()method must now be called to
 get final error message strings out of it.
- Replaced asP()withasDiv(), as invalid markup nesting breaks React
 when browsers perform error correction on the DOM.
- Renamed Field.extraCLassesoption toField.cssClass.
- Renamed asUL()methods toasUl().
- Order of mixing in fields from when multiple Forms are passed to __mixin__
 has changed from right-to-left to left-to-right.
- Only one custom field cleaning functon will be called: clean<FieldName>
 orclean_<fieldName>in that order. The ability to define both and have
 both run was unintentional.
New Features
- A typeattribute can now be passed to Widgets to take advantage of new
 HTML widget types.- Added EmailInput-- now the default widget forEmailField
- Added URLInput-- now the default widget forURLField
- Added NumberInput-- now the default widget forIntegerField,
 FloatFieldandDecimalField- IntegerField,- FloatFieldand- DecimalFieldnow set HTML5- max,
 - minand- steoattributes on their widget, as applicable.
 
 
- Added 
- formDatanow supports new input types: 'email', 'url', 'number' and 'file'
- If a field throws a ValidationErrorwhile checking if it's changed, the
 assumption is now that it's changed.
- cleanedDatais no longer deleted when a form is invalid.
- CheckboxSelectMultiplenow uses a similar renderer to- RadioSelect--
 individual checkbox subwidgets can now be accessed.
- idattributes are now added to lists of radio and checkbox inputs.
- Radio and checkbox input lists can now display with nested choices
- SlugFieldand- URLFieldnow support whitespace stripping.
- Changed data checking now supports calling initial values which are functions.
- Added minNum,validateMaxandvalidateMintoformsetFactoryand
 BaseFormSet.
- Added a hard limit to the maximum number of forms in a FormSet--maxNum
- 
- FormSet deletion management data is no longer removd from cleanedData.
- MultiWidgetnow sets- needsMultipartFormbased on its child widgets.
- Added requireAllfieldsoption toMultiValueField-- this allows for
 optional subfields whenfalseand a new'incomplete'validation error
 being thrown when required field are empty.
- Added an addError()method to forms which can be used to set field or
 non-field errors and automatically removes fields fromcleanedData,
- cleanedDatadoesn't need to be returned from- Form.clean()any more,
 but if it is, it will still be set as- form.cleanedData.
- Made emptyValuesa property ofField.prototypeso it can be overridden
 by subclasses if necessary.
- TypedChoiceField#coercecan now return an arbitrary value.
- labelSuffixcan now be customised when calling- BoundField#labelTag.
- validators_ is now exposed as- forms.validators.
- Added Field#isEmptyValueandField#emptyValueArrayto ensure empty
 arrays are detected as empty values by default.
- Added the ability to avoid inheriting a field from an extended or mixed-in
 Form by shadowing its field name with a non-field property.
- Added asData()andtoJSON()toErrorObjectandErrorList.
- Custom clean<FieldName>()methods no longer have to return a cleaned
 value, but if they do, it will be inserted back intocleanedData.
- ClearableFileInputnow uses overridable functions for templating, making
 it easier to customise.
- FileFieldnow validates that a file is selected when- requiredis
 - truein browsers.
- Default rendering methods now allow arbitrary HTML in helpTextif
 {__html: ''}is passed instead of a string.
- Added form.setData()to bind new data to a form and re-trigger cleaning.
- Added a customargument when constructing Fields, to store any metadata
 you need for later.
- ImageFieldnow adds an- accept="image/*"attribute to its widget.
- Added form.util.makeChoiceshelper for creating [value, label] pairs from
 a list of objects.
- Flat lists of choicescan now be passed into Fields and Widgets which take
 choices.
- Made hidden fields controlled components which always reflect form state on
 each render, since there's no way for the user to interact with them.
- Made FormSets more usable on the client-side:
- Form instances aren't cached, so adding and removing forms by tweaking form
 count variables works without having to recreate the formset, or touching
 undocumented state.
- ManagementForm isn't used for formset configuration details when the formset
 is bound - as a result, you don't have to render its hidden fields for
 browser-only usage.
- If rendered, the ManagementForm always reflects FormSet state, not bound
 data, so doing things like bumpingformset.extrato show another form
 works regardless of whether or not the formset is bound.
- Added a setData()method to bind newformset.dataand re-trigger
 validation.
 
- Form instances aren't cached, so adding and removing forms by tweaking form
Bug Fixes
- '0'should be treated as true by- CheckboxInput.
- CheckboxInput._hasChangednow handles an initial- 'false'String.
- FloatFieldand- DecimalFieldnow accept '1.' as a valid input.
- Fixed form constructors used as mixin mixins  having their own
 baseFieldsoverwritten and the prototype properties intended for the new
 form applied to them.
- Fixed Boundfield#subWidgetsnot passingidorautoIdalong, so
 label htmlFors and input ids weren't getting generated.