fastlife.adapters.jinjax.widget_factory.union_builder

Handle Union type.

Module Contents

Classes

UnionBuilder

Builder for Union.

API

class fastlife.adapters.jinjax.widget_factory.union_builder.UnionBuilder(factory: fastlife.adapters.jinjax.widget_factory.factory.WidgetFactory)

Bases: fastlife.adapters.jinjax.widget_factory.base.BaseWidgetBuilder[typing.Any]

Builder for Union.

Initialization

accept(typ: type[Any], origin: type[Any] | None) bool

True for unions Union[A,B], A | B or event Optional[A], A | None

build(*, field_name: str, field_type: type[Any], field: pydantic.fields.FieldInfo | None, value: Any | None, form_errors: collections.abc.Mapping[str, Any], removable: bool) fastlife.adapters.jinjax.widgets.base.Widget[Any]

Build the widget.