Automatically generates Django admin actions based on your model's fields
Project description
Django Auto Actions
Automatically generates Django admin actions based on your model's 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:
Use AutoActionsModelAdmin (instead of ModelAdmin)
from django_auto_actions import AutoActionsModelAdmin
@admin.register(YourModel)
class YourModelAdmin(AutoActionsModelAdmin):
...
or Use the AutoActionsMixin mixin
from django.contrib.admin import ModelAdmin
from django_auto_actions import AutoActionsMixin
@admin.register(YourModel)
class YourModelAdmin(AutoActionsMixin, ModelAdmin):
...
If you don't want auto actions on some fields, you can set the exclude_auto_actions
attribute.
@admin.register(YourModel)
class YourModelAdmin(AutoActionsMixin, ModelAdmin):
exclude_auto_actions = ["is_example", "created_at"]
This will automatically create admin actions for your model's BooleanFields, DateTimeFields, DateFields and TimeFields.
Example
Here's an example of what it might look like for a simple Homework
model:
And will display a success message like this:
Support & Contributing
Please consider giving the project a star. Your PRs are welcome!
Authors
- Félix Gravel — @Flexonze
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_auto_actions-0.1.4.tar.gz
.
File metadata
- Download URL: django_auto_actions-0.1.4.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 857a5d55662dd348295acaddb7cf5430a5c5dd013a901022f8867de3a7bcd931 |
|
MD5 | 1f30471b9d1d04e74ffa5cc694f24c2b |
|
BLAKE2b-256 | 0f62ab917b12d7a110677ee1d9c65413d436e5e5992aabd65a753e6bc1172d32 |
File details
Details for the file django_auto_actions-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: django_auto_actions-0.1.4-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f106481e14f11d6d3c9a0dded223d39e3b0cf880f1c2906cb0f81d74d130415e |
|
MD5 | 5aa487180f765167ebe6fbf26059754f |
|
BLAKE2b-256 | 941516bbd47385aa09aa6e9affcc00be16e6717a6ee7bbac5dfd379b1365e488 |