django-object-actions

Add custom object tool buttons to the Django admin as easily as admin actions

Library
PyPI
v5.1.2
812stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
58/100Fair
Development Activity40
Maintenance44
Community68
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
82/100Excellent
Architecture82
Code Quality85
Innovation74
Learning Curve88

django-object-actions is a Django app that makes adding custom action buttons to the Django admin as simple as writing standard admin actions. Instead of wrestling with admin object-tools templates and URL wiring, you declare methods on your ModelAdmin and list them in change_actions or changelist_actions to get clickable buttons on the change and change-list pages.

Each action receives a request and a single object instance (rather than a queryset), making per-record operations like publishing an article, sending a test email, or regenerating a token straightforward. It supports labels, descriptions, custom attributes, and reusing existing admin actions, giving developers a clean, well-tested way to extend the admin UI.

What You Get

  • A DjangoObjectActions mixin for ModelAdmin that renders custom buttons on change and change-list pages
  • An action decorator for setting a button label, description, and HTML attributes
  • Per-object callbacks that receive (request, obj) instead of a queryset for single-record operations
  • The ability to reuse existing Django admin actions as object tools

Common Use Cases

  • Adding a per-record button like Publish, Approve, or Send test email to the admin change page
  • Exposing bulk-style operations as a single button on the admin change-list page
  • Triggering side effects such as regenerating tokens or syncing external systems from the admin
  • Building lightweight internal admin tooling without custom views or URL configuration

Under The Hood

Architecture - The package is compact: django_object_actions/utils.py (about 409 lines) holds the DjangoObjectActions mixin, the BaseDjangoObjectActions logic, and the action decorator. The mixin overrides ModelAdmin hooks (change_view, changelist_view, get_urls) to inject button context and register per-action URLs that dispatch to the named methods, while templates in templates/django_object_actions (change_form.html, change_list.html, action_trigger.html) render the buttons and a bundled CSS file styles them. apps.py registers the Django app config so templates and static files are discoverable once added to INSTALLED_APPS.

Tech Stack - Pure Python targeting Django, distributed as a standard reusable Django app with templates and static assets. It has no runtime dependencies beyond Django itself and is packaged with modern Python tooling; the repo also carries a small example project, a Makefile, and a Dockerfile for development.

Code Quality - The project is mature (312 commits, 27 releases since 2012) and well tested, with a dedicated tests package covering admin integration (test_admin.py), the utils/mixin (test_utils.py), and URL wiring (test_urls.py). Continuous integration runs on GitHub Actions, and the small, focused surface keeps the code readable.

API Design - The API is intentionally minimal and mirrors Django’s own admin-actions pattern, so Django developers need almost no new concepts: add the mixin, define a method, list its name. The optional action decorator adds labels and descriptions declaratively, and the README’s quick-start gets a working button in a few lines.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search