Class: SubForm
Container for a set of fields to be treated together as a single field.
A typical use case for this field is to treat as whole a set of fields, where the set itself is optional but some member fields are required if any values are given. This would correspond to the other end of an nullable foreign key in a relational database.
While there is a certain amount of isolation from it, it should still be recognized that child fields belong to the same form as their parent field. In particular, care must be taken when assigning names of request parameters to fields, as they use the same namespace as the rest of the form. The recommended way to accommodate this is to introduce some sort of prefix for the parameter names of child fields, for example 'address_street', 'address_city', etc.
Methods
has_value (self, input)
Return whether a value has been given for any of the child fields in the given MultiDict of input.
required (self)
Return whether the field is mandatory.
translate (self, input)
Translate the field from a MultiDict of values.
If the field is not required, and none of its child fields has a value, return None. Otherwise, process each child field.
Raise TranslationError if the field is required but none of its child fields has a value, or ErrorSet if translation fails for of any of the child fields.
Attributes
Value of
None