v0.9.0
(For an alternative view of new features/changes, see the Development Wiki)
This release brings a bunch of sanity improvements (auto validation by default, better basic validation API) and improvements to FormSets which just about make them usable on the client (see Dinner Time! for an example).
Breaking Changes
- Form mixins must now be specified as a
__mixins__
property rather than
__mixin__
. - Changed
form.validate()
to no longer call back to re-render -- this
was convenient for single forms, but results in multiple updates when
processing multiple forms. Re-rendering must now be triggered manually if
onSubmit validation fails. formset.cleanedData()
to no longer includescleanedData
from unmodified
extra forms.
New Features
- Passing
onChange
to a Form or FormSet now impliesvalidation: 'auto'
. - Added
form.notEmpty()
to determine when required fields in an extra
FormSet form become truly required. - Added
formset.validate([form])
-- equivalent to the Form version, use to
set a formset's data from a<form>
or to force full validation of its
current input data. - Added
formset.removeForm(index)
to remove extra forms from a FormSet. It
will also call back to trigger a re-render when possible. - Added
errorlist#first()
for conveniently getting just the first validation
error message. - Added
formset.addError()
for adding non-form errors outside ofclean()
. - Changed
form.validate([form])
so the argument is optional - it can now be
used to force full validation of a form with its current input data. - Form
clean()
functions can now specify which fields they make use of for
cross-field validation:clean: ['field1', 'field2', function() {}]
. When
provided,clean()
will only be called during partial form updates (e.g.
onChange
handling) if one of the specified fields is affected.
Deprecations
- The
onStateChange
argument to Form and FormSet constructors -- use
onChange
instead.onStateChange
will be removed in the next version.
Changes
onChange
handlers are now always attached to widgets to update input data,
regardless of controlled/validation config.formset.addAnother()
will now call back to trigger a re-render if
possible.- Changed partial form validation to remove any validation errors if an extra
FormSet form is unchanged from its initial values.