Skip to main content

Django Auto Actions

PyPI PyPI - Python Version PyPI - License Ruff Coverage

Automatically generates basic Django admin actions based on your models' fields

Installation

Install the package using pip

pip install django-auto-actions

Usage

There are two ways to integrate django-auto-actions into your project:

  1. Using AutoActionsMixin (recommended way)
from django.contrib.admin import ModelAdmin
from django_auto_actions import AutoActionsMixin


@admin.register(YourModel)
class YourModelAdmin(AutoActionsMixin, ModelAdmin):
    ...
  1. Using AutoActionsModelAdmin instead of ModelAdmin
from django_auto_actions import AutoActionsModelAdmin


@admin.register(YourModel)
class YourModelAdmin(AutoActionsModelAdmin):
    ...

With either method, django-auto-actions will automatically generate admin actions for your model's BooleanFields, DateTimeFields, DateFields and TimeFields.

To exclude certain fields from having automatic admin actions generated, set the exclude_auto_actions class-level attribute.

@admin.register(YourModel)
class YourModelAdmin(AutoActionsMixin, ModelAdmin):
    exclude_auto_actions = ["is_example", "created_at"]

Example

Here's an example of what it might look like for a simple Homework model:
Example auto actions
And will display a success message like this:
Example success message

Running Tests

pip install -r requirements.txt
docker compose up -d
python runtests.py

Support & Contributing

If you like it, please consider giving this project a star. If you’re using the package, let me know! You can also create an issue for any problems or suggestions. PRs are always welcome!

Authors

Release files for django-auto-actions 1.0.0

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-auto-actions 1.0.0
File Size Uploaded
django_auto_actions-1.0.0.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-auto-actions 1.0.0
File Interpreter ABI Platform
django_auto_actions-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.9 kB

Release files / django_auto_actions-1.0.0.tar.gz

Download URL django_auto_actions-1.0.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8cd311d5804c5243432cdc1459c172f9eebe7fe3b32695aaddcfafb4726e679a
BLAKE2b-256 checksum
How to use checksums
685e4b0ace2698c12aeb66c527d82f9da03a61c63f461b25467aeac7e230c9f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.7

Release files / django_auto_actions-1.0.0-py3-none-any.whl

Download URL django_auto_actions-1.0.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1f96de0e53c1fc6e483d0d6f5fa2848e553850ccc43be3822fb68324d444f54
BLAKE2b-256 checksum
How to use checksums
75d24f64bd73df65bdbe465e65a93b3e1c4969d754ec40b09b44c8cedbd14cc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.7

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.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