fastlife.adapters.jinjax.widgets.union

Widget for field of type Union.

Module Contents

Classes

UnionWidget

Widget for union types.

API

class fastlife.adapters.jinjax.widgets.union.UnionWidget(name: str, *, title: str | None, hint: str | None = None, aria_label: str | None = None, value: fastlife.adapters.jinjax.widgets.base.Widget[Any] | None, error: str | None = None, children_types: collections.abc.Sequence[type[pydantic.BaseModel]], removable: bool = False, token: str)

Bases: fastlife.adapters.jinjax.widgets.base.Widget[fastlife.adapters.jinjax.widgets.base.Widget[typing.Any]]

Widget for union types.

Parameters:
  • name – input name.

  • title – title for the widget.

  • hint – hint for human.

  • aria_label – html input aria-label value.

  • value – current value.

  • error – error of the value if any.

  • children_types – childrens types list.

  • removable – display a button to remove the widget for optional fields.

  • token – token used to get unique id on the form.

Initialization

build_types(route_prefix: str) collections.abc.Sequence[fastlife.adapters.jinjax.widgets.base.TypeWrapper]

Wrap types in the union in order to get the in their own widgets.

get_template() str
to_html(renderer: fastlife.services.templates.AbstractTemplateRenderer) markupsafe.Markup

Return the html version.