FormSets

Guide

TBD

API

class BaseFormSet([kwargs])

A collection of instances of the same Form.

Arguments:
  • kwargs (Object) – configuration options.
kwargs.data

input form data, where property names are field names.

kwargs.files

input file data.

kwargs.autoId

a template for use when automatically generating id attributes for fields, which should contain a {name} placeholder for the field name – defaults to id_{name}.

kwargs.prefix

a prefix to be applied to the name of each field in each form instance.

kwargs.initial

a list of initial form data objects, where property names are field names - if a field’s value is not specified in data, these values will be used when rendering field widgets.

kwargs.errorConstructor

the constructor function to be used when creating error details - defaults to ErrorList.

formsetFactory(form[, kwargs])

Returns a FormSet constructor for the given Form constructor.

Arguments:
  • form (Form) – the constructor for the Form to be managed.
  • kwargs (Object) – arguments defining options for the created FormSet constructor - all arguments other than those defined below will be added to the new formset constructor’s prototype, so this object can also be used to define new methods on the resulting formset, such as a custom clean method.
kwargs.formset

the constructuer which will provide the prototype for the created FormSet constructor – defaults to BaseFormSet.

kwargs.extra

the number of extra forms to be displayed – defaults to 1.

kwargs.canOrder

if true, forms can be ordered – defaults to false.

kwargs.canDelete

if true, forms can be deleted – defaults to false.

kwargs.maxNum

the maximum number of forms to be displayed – defaults to 0.