Skip to main content

Reuse model admin changelist actions on changeform pages

Project description

django-admin-changeform-actions

Run pytest Run tox

Replicates the admin actions dropdown (available on a model's changelist page) on each model instance's changeform page.

Instead of targetting a selection the action will target the current model instance only.

Note: Once #12090 makes its way into Django admin (with 6.1, expected in August 2026), this package will hopefully become obsolete!

Installation

Install the package:

pip install django-admin-changeform-actions

Modify your Django project like:

# settings.py

INSTALLED_APPS = [
  "changeform_actions",  # Must be placed before Django's admin app!
  ...
  "django.contrib.admin",
]
# urls.py

urlpatterns = [
  path("", include("changeform_actions.urls"))
]
# admin.py

from changeform_actions import ChangeFormActionsMixin

class MyModelAdmin(ChangeFormActionsMixin, admin.ModelAdmin):
    actions = [...]

Django Settings

# Whether to display an `Action: <name>` success message after running
# an action. Disable this if you want to display no message or a custom
# message, e.g. as part of each action.
CHANGEFORM_ACTIONS_ENABLE_DEFAULT_MESSAGE: bool = True

# Enable this to preselect the last action in the dropdown, which is
# helpful to repeatedly run the same action several times.
CHANGEFORM_ACTIONS_REMEMBER_LAST_ACTION: bool = False

Development Setup

This project uses uv to handle python versions and dependencies.

uv sync

To do a new release, bump the version in pyproject.toml, then:

uv build
uv publish

Tests

uv run pytest

Run test matrix of different python versions VS different django versions:

uv run tox

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_admin_changeform_actions-0.6.1.tar.gz (60.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file django_admin_changeform_actions-0.6.1.tar.gz.

File metadata

File hashes

Hashes for django_admin_changeform_actions-0.6.1.tar.gz
Algorithm Hash digest
SHA256 37e23c8075f10251b1d5a64ae4d8a33ac76e89cc9148814fc6ee9c689110cef7
MD5 1525a1ee530cd4db06af78e9f52e6537
BLAKE2b-256 065530535138d00a69239721af633e53421873179e0e7d7ddbd40229580905eb

See more details on using hashes here.

File details

Details for the file django_admin_changeform_actions-0.6.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_changeform_actions-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 13226d53547efcfff3a88746b8b345338544ca1c6459eb60a957fc23e2894b8b
MD5 5b40036f8a21c4b8736e8370a97b8317
BLAKE2b-256 a5a2aa5a1e0687e7fd2dbca2d1ca3094d86b13c247219f7c61d4a1f386aacc45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page