useModelAction
Overview
Provides target, execution, copy, dry-run, and redirect plumbing for model actions. It does not create or consume a form context; form shells layer useActionForm or ActionForm on top when they need submit UI and validation summaries.
Signature
useModelAction(props)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| props | object | yes | Reactive action configuration. |
props Properties
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| action | string | Action identifier sent to the server. | ||
| actionErrorSummary | string | Toast summary shown when the action fails. | ||
| actionSuccessSummary | string | Toast summary shown on successful action completion. | ||
| actionVerboseName | string | Human-readable action name. | ||
| app | string | Django app label that owns the model. | ||
| bannerDescription | string | Optional banner description. | ||
| bannerTitle | string | Optional banner title. | ||
| confirmMessage | string | Confirmation message shown to the user before submitting. | ||
| enableDryRun | boolean | Whether to perform dry-run validation. | ||
| fetchState | object | Selected-object fetch state. | ||
| instanceList | object | object | List instance that holds the selected objects. Bulk actions use it to reconcile displayed rows after a real destroy. Omit it to use a private transport-only list. | ||
| model | string | Django model name the action targets. | ||
| pk | string | number | string[] | number[] | Optional primary key or primary keys when no fetch state is ready. | ||
| requestMethod | string | HTTP method used for non-destroy action requests. | ||
| tone | "neutral" | "info" | "warning" | "success" | "danger" | Sentiment tone. | ||
| transformSubmitDataFn | (values: any) => any | Optional form-value transform. |
Returns
Source
client/lib/use/useModelAction.js:101