Skip to main content

pypi

django-managerie

:lightbulb: Expose Django management commands as forms in the admin, like so:

Screenshot

Requirements

  • Django 4.2+ (this project tracks Django's end-of-life policy)
  • Python 3.10+

Installation

Install the package as you would any Python package, then add django_managerie to your INSTALLED_APPS.

Automatic patching

This is the easiest way to get up and running. You can have Managerie patch the admin site's dashboard view to include pseudo-models with the name "Commands" for all apps where management commands are available, and while it's at it, it'll also include URLs of its own.

Hook up Managerie to your admin site (e.g. in urls.py, where you have admin.autodiscover()), like so:

from django.contrib import admin
from django_managerie import Managerie
# ...
managerie = Managerie(admin_site=admin.site)
managerie.patch()

No patching

This is likely safer (in the presence of slightly less tolerant 3rd party apps that mangle the admin, for instance), but you can't enjoy the luxury of the Commands buttons in the admin dashboard.

from django.contrib import admin
from django.conf.urls import include, url
from django_managerie import Managerie
# ...
managerie = Managerie(admin_site=admin.site)
# ...
urlpatterns = [
    # ...
    # ... url(r'^admin/', include(admin.site.urls)), ...
    url(r'^admin/', include(managerie.urls)),  # Add this!
]

Usage

If you allowed Managerie to patch your admin, superusers can now see Commands "objects" in the admin dashboard. If you didn't patch the admin, you can access a list of all commands through /admin/managerie/ (or wherever your admin is mounted).

If you click through to a command, you'll see the arguments of the command laid out as a form. Fill the form, then hit "Execute Command", and you're done! :sparkles:

Accessing the Django request from a managerie'd command

Managerie sets _managerie_request on the command instance to the current Django request. You can use it to access the request, for instance, to get the current user.

Accessing standard input

By default, Managerie will patch sys.stdin to be an empty stream. If you need to read from standard input (e.g. long input), set the managerie_accepts_stdin attribute on your command class to True.

This will cause Managerie to add a text-area to the form, which will be passed to the command as standard input.

Note that sys.stdin.buffer (binary mode) is not supported.

TODO

  • More argparse action support
  • Multiple-argument support (nargs)

Metadata

Release files for django-managerie 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-managerie 0.6.1
File Size Uploaded
django_managerie-0.6.1.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-managerie 0.6.1
File Interpreter ABI Platform
django_managerie-0.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / django_managerie-0.6.1.tar.gz

Download URL django_managerie-0.6.1.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
daf90f3a3bc766bc80ef948ff271cd4eba8ac6c855b2e5a01239bc5cf2346fa5
BLAKE2b-256 checksum
How to use checksums
3a915bba36eddd1d31062cd1adb36a1d4188042303e448b8952a0ac2f7553984
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 5, 2025.

Transparency log

Release files / django_managerie-0.6.1-py3-none-any.whl

Download URL django_managerie-0.6.1-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1af527e42c8a9c30f9c54203656c57682829468d68373d324d4484da068bf310
BLAKE2b-256 checksum
How to use checksums
51c0576fa849050fbfbd09f65bec493f16181f271e1caf14214ee4b7a33e7e38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 5, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.2

3 release files

0.1

2 release files

0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page