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.2.tar.gz
.
File metadata
- Download URL: django_auto_actions-0.1.2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b673053c588c6bacdad9e3ea139f9ff336ff78116923539de9574fb337e8e3a |
|
MD5 | 9ba1ecde3b4afe0e9b0227af8b901f4c |
|
BLAKE2b-256 | 7edbcb8f72436fdc4a14abde807848f3a1e7a81f0ada867623b3530bad16bdb0 |
File details
Details for the file django_auto_actions-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: django_auto_actions-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.2 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 | a7fe2d3a8399173f6bf2d656dcc6918511bd74701a1f61bb2f26b290489f685a |
|
MD5 | 94c791921f6f705c195973e59208e13c |
|
BLAKE2b-256 | a94e6299f1fce40601e3351618ae428b7540c16d08e7df81077c7cde9c0570bd |