caais.widgets - Custom Django form widgets for CAAIS

class caais.widgets.DateOfMaterialsWidget(attrs=None)

Bases: TextInput

Custom widget for date_of_materials field for use in the MetadataForm.

render(name: str, value: str | None, attrs: Dict[str, Any] | None = None, renderer: BaseRenderer | None = None) SafeString

Render the widget with additional HTML elements.

property media
class caais.widgets.DateIsApproximateWidget(attrs=None, check_test=None)

Bases: CheckboxInput

Custom widget for date_is_approximate field for use in the MetadataForm.

render(name: str, value: Any, attrs: Dict[str, Any] | None = None, renderer: BaseRenderer | None = None) SafeString

Render the widget with additional HTML elements.

property media
class caais.widgets.CustomCountrySelectWidget(*args: Any, **kwargs: Any)

Bases: CountrySelectWidget

Custom Country Select Widget that wraps the rendered field in a container div, so that both the select field and the flag show side by side.

FLAG_LAYOUT = '{widget}<img class="country-select-flag" id="{flag_id}" src="{country.flag}" alt="" aria-hidden="true">'
render(name: str, value: Any, attrs: Dict[str, Any] | None = None, renderer: BaseRenderer | None = None) SafeString

Render the widget with a container div around it.

property media