newforms v0.11.0 Release Notes

Release Date: 2015-03-11 // about 9 years ago
  • ๐Ÿš€ See the Upgrade Guide for instructions on upgrading to this release from the previous version.

    ๐Ÿ’ฅ Breaking Changes

    • ๐Ÿ“‡ Renamed BaseForm to Form, changing the top-level API - this has the same
      behaviour as the currently-exported forms.Form.
    • ๐Ÿ“‡ Renamed BaseFormSet to FormSet, changing the top-level API.
    • Replaced util.formData() with the
      ๐Ÿ“ฆ get-form-data module -
      formData() has been renamed to getFormData().
    • ๐Ÿ†• Newforms is now published to npm as flattened, top-level modules, so
      individual modules (such as Form, FormSet, fields, widgets, React
      components, ValidationError...) can be required with
      require('newforms/<modulename>') - this makes it possible to reduce the size
      ๐Ÿ’ป of your own browser bundles by requiring only what you use.

    ๐Ÿ†• New Features

    • โž• Added new core Field argument: field.widgetAttrs - this allows you to
      provide additional widget attributes without having to redefine the entire
      โœ… widget (docs) (#62)
    • โž• Added Form.prototype.prefixFormat ('{prefix}-{name}') and
      ๐Ÿ›  FormSet.prototype.prefixFormat ('{prefix}-{index}') to define how prefixes
      are generated. These can be overridden when extending these components to
      ๐Ÿ›  customise now field names are generated when prefixes are used
      โœ… (example) (#70)

    ๐Ÿ”„ Changes

    • โž• Added former formsetFactory() options to FormSet proper (API docs)
      • FormSet can now be constructed directly, setting all formset-specific options for the instance instead of having to extend it,
      • FormSet.extend() can now be used directly to preconfigure a FormSet
        constructor with the Form constructor to be used and any other formset
        options.
    • FormSet options can now be overridden when constructing a FormSet.
    • An error will now be thrown if a FormSet is constructed without a Form
      constructor.
    • ๐Ÿ’ป FileField cleaned data is now a native File object, when the browser
      ๐Ÿ‘Œ supports it (docs) (#61)
      • Added a multiple argument for FileField - cleaned data will be a list of
        File objects.
      • Filename length and empty file validation can now be performed on the client
        when a File object is available.
    • 0๏ธโƒฃ Widget attribute defaults are now always provided by numeric fields when not
      already set, regardless of the type of widget being used, to allow custom
      widgets which don't extend NumberInput to make use of them
      (#59)

    ๐Ÿ› Bug Fixes

    • DecimalField now handles all-zero inputs correctly - it was cleaning them
      to an empty string (#57)
    • โš  Select widgets no longer generate React dev-mode warnings about unique key
      props (#68)

    ๐Ÿ—„ Deprecations

    • ๐Ÿ—„ formsetFactory() is deprecated in favour of using FormSet.extend() to
      0๏ธโƒฃ create a FormSet with defaults for the same options and any custom methods
      required.

    Removals

    • โœ‚ Removed deprecated Form rendering methods (render(), asTable(), asDiv()
      and asUl()).
    • โœ‚ Removed deprecated FormSet rendering methods (render(), asTable() and
      asDiv()).