Hooks¶
CommandHook
¶
Base class for command execution hooks.
Subclass and implement setup(), pre_save(), and/or post_save().
pre_save
¶
Called after command execution but before the DB save.
post_save
¶
post_save(
command_name: str,
kwargs: dict,
execution: CommandExecution,
ctx: HookContext,
) -> None
Called after the DB save completes. Replaces the old teardown().
teardown
¶
Deprecated: override :meth:post_save instead.
HookContext
¶
Dict-like state bag scoped to a single command execution.
Lets hooks share data between setup() and teardown() without
coupling hooks to each other. A fresh instance is created per execution.
Source code in src/django_admin_runner/hooks.py
TempFileHook
¶
Bases: CommandHook
Creates a unique upload directory under ADMIN_RUNNER_UPLOAD_PATH
in setup() and removes it in post_save().
Only active when ADMIN_RUNNER_UPLOAD_PATH is configured.