Run Django management commands from the admin with auto-generated forms and pluggable task runners
Project description
django-admin-runner
Run Django management commands from the admin — with auto-generated forms, pluggable task runners, and a unified execution log.
Documentation | PyPI | Changelog
Features
@register_commanddecorator — register any management command with metadata- Auto-generated forms — argparse arguments become Django form fields automatically
- Widget & form customisation — override widgets per-argument (
widget=onadd_argument), supply a customFormclass, or use per-parameter field overrides in the decorator - Built-in file fields —
FileOrPathField(upload or server path),FileField,ImageField - Pluggable runners — Django Tasks (default), Celery, sync, or custom
- Execution log — every run is stored as a
CommandExecutionrecord - Permission control — per-command permission requirements (superuser, Django perms, or a list)
- Model attachment — show a "Run" button on any model's admin change-list via
models=[...] - Unfold support — auto-detected, uses Unfold templates and widgets when available
Installation
pip install django-admin-runner
Add to INSTALLED_APPS:
INSTALLED_APPS = [
...
"django_admin_runner",
]
Run migrations:
python manage.py migrate
Quick start
# myapp/management/commands/my_command.py
from django.core.management.base import BaseCommand
from django_admin_runner import register_command
@register_command(group="Maintenance", permission="myapp.change_mymodel")
class Command(BaseCommand):
help = "Does something useful"
def add_arguments(self, parser):
parser.add_argument("--count", type=int, default=10)
parser.add_argument("--dry-run", action="store_true")
def handle(self, *args, **options):
self.stdout.write(f"Running {options['count']} times")
Visit /admin/django_admin_runner/commandexecution/commands/ to run your commands.
Custom widgets
Override how individual parameters render — right inside add_arguments:
from django_admin_runner import FileOrPathField, register_command
@register_command(group="Import")
class Command(BaseCommand):
def add_arguments(self, parser):
# File upload OR server-side path text field
parser.add_argument("--source", widget=FileOrPathField(), default="data.csv")
# Swap to a textarea
parser.add_argument("--notes", widget=forms.Textarea(attrs={"rows": 3}))
# Image upload (requires Pillow)
parser.add_argument("--photo", widget=forms.ImageField(required=False))
Or provide a fully custom form class:
@register_command(form_class=MyImportForm)
class Command(BaseCommand):
...
See the Widget & form customisation docs for the full reference.
Development
# Install dependencies and pre-commit hooks
just install
# Run tests
just tests
# Run linters
just check
# Serve docs locally
just docs
Contributing
Contributions are welcome! Please open an issue or pull request on GitHub.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_admin_runner-0.1.0.tar.gz.
File metadata
- Download URL: django_admin_runner-0.1.0.tar.gz
- Upload date:
- Size: 26.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a0e3c1998905484cfe7fbcef9f275a14fc02fa21e86cd05e9988dd7480ec86c
|
|
| MD5 |
5c7b9288dbf4faf88669d61f52dc48b3
|
|
| BLAKE2b-256 |
cf1662f5407b8cb6b8f1d9b4c4cf8f79ee74f9370aa2191a7b67aea40d62b034
|
Provenance
The following attestation bundles were made for django_admin_runner-0.1.0.tar.gz:
Publisher:
publish.yml on burgdev/django-admin-runner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_admin_runner-0.1.0.tar.gz -
Subject digest:
2a0e3c1998905484cfe7fbcef9f275a14fc02fa21e86cd05e9988dd7480ec86c - Sigstore transparency entry: 1354207353
- Sigstore integration time:
-
Permalink:
burgdev/django-admin-runner@5ff0b465309798bef69b39638b562f9c8a6a5ce5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/burgdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5ff0b465309798bef69b39638b562f9c8a6a5ce5 -
Trigger Event:
repository_dispatch
-
Statement type:
File details
Details for the file django_admin_runner-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_admin_runner-0.1.0-py3-none-any.whl
- Upload date:
- Size: 40.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b89b00911bad7d1f80574b8938621f6624cee641ff59d38cc637bce65d062dc
|
|
| MD5 |
2cf1d44a02845fbb692fb76b0226a887
|
|
| BLAKE2b-256 |
bd2363b16a13217e786744bf046201f1fbe181a730a5b0a16ab443065ad5df1d
|
Provenance
The following attestation bundles were made for django_admin_runner-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on burgdev/django-admin-runner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_admin_runner-0.1.0-py3-none-any.whl -
Subject digest:
7b89b00911bad7d1f80574b8938621f6624cee641ff59d38cc637bce65d062dc - Sigstore transparency entry: 1354207517
- Sigstore integration time:
-
Permalink:
burgdev/django-admin-runner@5ff0b465309798bef69b39638b562f9c8a6a5ce5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/burgdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5ff0b465309798bef69b39638b562f9c8a6a5ce5 -
Trigger Event:
repository_dispatch
-
Statement type: