WidgetGenericAutoComplete
Overview
A generic foreign-key widget for Django content-type style relations. Renders a type selector combobox paired with an object search combobox, storing a { content_type, object_id } value pair.
Theme entry: WidgetGenericAutoComplete
Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| name | String | undefined | The widget name; falls back to the field context value when omitted. | |
| label | String | undefined | The label displayed next to the widget; falls back to the field context value when omitted. | |
| help | String | undefined | Help text displayed alongside the widget; falls back to the field context value when omitted. | |
| readOnly | Boolean | false | Whether the widget is read-only; falls back to the field context value when omitted. | |
| required | Boolean | undefined, // let the default from field context take over | Whether the widget is required; falls back to the field context value when undefined. | |
| modelValue | String|Number|Boolean|Array|Object | undefined | The widget's bound value (v-model); used only in contextless mode. | |
| fieldToWidget | Object|Function | null | Adapter that converts the form model value into a value suitable for the widget UI. | |
| widgetToField | Object|Function | null | Adapter that converts the widget UI value back into a form model value for validation and submission. | |
| invalid | Boolean | undefined | Manually set the invalid state when not in a field context. | |
| warning | Boolean | undefined | Manually set the warning state when not in a field context. | |
| disabled | Boolean | false | Whether the widget is disabled. | |
| disabledFn | Function | null | A function that returns whether the widget should be disabled; takes precedence over the disabled prop. | |
| contextless | Boolean | false | When true, the widget ignores any surrounding field or form context and manages its own state. | |
| displayDependencies | Array | () => [] | Field paths whose values the widget needs for display logic; registered with the field context. | |
| app | string | yes | Django app label used to identify the target model. | |
| model | string | yes | Django model name within the app used to identify the target model. | |
| modelFields | array | yes | List of field names to request from the API when searching for autocomplete suggestions. |
Events
| Name | Description |
|---|---|
update:modelValue | Emitted when the widget value changes. |
Source
client/lib/widgets/WidgetGenericAutoComplete.vue