register_command¶
register_command
¶
register_command(
name: str | None = None,
*,
group: str | None = None,
permission: str | list[str] = "superuser",
params: list | None = None,
exclude_params: list | None = None,
models: list | None = None,
widgets: dict | None = None,
form_class=None,
display_name: str | None = None,
)
Decorator to register a management command with the admin runner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Command name. Defaults to the command's module name. |
None
|
group
|
str | None
|
Group label shown in the admin list. Defaults to the app label. |
None
|
permission
|
str | list[str]
|
Who may run this command. |
'superuser'
|
params
|
list | None
|
Allowlist of argument |
None
|
exclude_params
|
list | None
|
Denylist of argument |
None
|
models
|
list | None
|
List of Django model classes. A "Run" link for this command will
appear on each model's admin change-list page when
|
None
|
widgets
|
dict | None
|
Per-parameter widget or field overrides. Keys are argument
|
None
|
form_class
|
A fully custom :class: |
None
|
|
display_name
|
str | None
|
Human-readable name for the command. Defaults to the
command name with underscores replaced by spaces and title-cased
(e.g., |
None
|