django-admin-action-hero¶
django-admin-action-hero is a small library to simplify the creation of custom admin actions.
Creating one-off admin actions isn’t difficult. You write a function and put that function name into your list of actions. If you are only writing the occasional action, or every action you write is unique, this library won’t be of much help for you.
If you find yourself building the same kinds of actions in multiple admins or projects, though, django-admin-action-hero is here for you. This library is meant to reduce the boilerplate necessary when writing similar kinds of actions over and over. For example, you might write multiple actions to queue different Celery tasks for different models. Using django-admin-action-hero, you can reduce most of that work into just writing the tasks you need to run without worrying about the action side of the problem.
This library provides the AdminActionBaseClass,
which can be extended to create custom admin actions. Also provided are two
ready-to-use action classes:
SimpleAction and
QueueCeleryAction. You can
use these implementations directly, extend them for your own customizations, or
use them as examples for creating your own action classes.
Contents:
Installation¶
To use django-admin-action-hero, you need to install it into your Python
environment. You can do this using either uv, poetry, pip, or any
package manager you prefer. The following examples show how to add the library
as a dependency in your project.
[dependencies] django-admin-action-hero = "0.1.1"
[tool.poetry.dependencies] django-admin-action-hero = "0.1.1"
django-admin-action-hero = "0.1.1"
uv add django-admin-action-hero=="0.1.1"
pip install django-admin-action-hero=="0.1.1"
django-admin-action-hero does not require any additional setup after
installation. You can start using the provided action classes or create your own
custom action classes right away.