newforms v0.9.0 Release Notes

Release Date: 2014-11-11 // over 9 years ago
  • ๐Ÿ‘€ (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 includes cleanedData from unmodified
      extra forms.

    ๐Ÿ†• New Features

    • Passing onChange to a Form or FormSet now implies validation: '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 of clean().
    • ๐Ÿ”„ 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.