Instance(doc, instance_class, **kwargs)[source]¶
Property for instances of a specified class
Instance Properties may be used for any type, but they gain additional power with HasProperties types. The Instance Property may be assigned a dictionary with valid HasProperties class keywords; this is coerced to an instance of the HasProperties class. Also, HasProperties methods behave recursively, so if the parent HasProperties class is validated, serialized, etc., then HasProperties Instance Properties on the class will also be validated, serialized, etc.
Available keywords (in addition to those inherited from Property):
- instance_class - The allowed class for the property.
- auto_create - DEPRECATED - set default to the instance_class instead. If True, this Property is instantiated by default. This is equivalent to setting the default keyword to the instance_class. If False, the default value is undefined. Note: auto_create passes no arguments, so it cannot be True if the instance_class requires arguments.