Django Auto Actions
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:
- Using AutoActionsMixin (recommended way)
from django.contrib.admin import ModelAdmin
from django_auto_actions import AutoActionsMixin
@admin.register(YourModel)
class YourModelAdmin(AutoActionsMixin, ModelAdmin):
...
- 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:
And will display a success message like this:
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
- Félix Gravel — @Flexonze
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)
| File | Size | Uploaded | |
|---|---|---|---|
| django_auto_actions-1.0.0.tar.gz | 6.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|