Skip to main content

Automatically generates Django admin actions based on your model's fields

Project description

Django Auto Actions

PyPI PyPI - Python Version PyPI - License

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:
Example auto actions
And will display a success message like this:
Example success message

Support & Contributing

Please consider giving the project a star. Your PRs are welcome!

Authors

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_auto_actions-0.1.5.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

django_auto_actions-0.1.5-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file django_auto_actions-0.1.5.tar.gz.

File metadata

  • Download URL: django_auto_actions-0.1.5.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.7

File hashes

Hashes for django_auto_actions-0.1.5.tar.gz
Algorithm Hash digest
SHA256 863b6cbf7c36ac6ac17e602b23517cb34f0ab090a9ca85c947ee9e1bc61117f4
MD5 62d6448a4ce62c6cf6ec45f054bbf3e1
BLAKE2b-256 ee429ae49cc22e6672cc9dc62b97c5d90b693289898c4829ee8ce40f09d9a1e2

See more details on using hashes here.

File details

Details for the file django_auto_actions-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for django_auto_actions-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a72e53eadadb681600cef524fc318eb7e8c8fffdabf2b2b9f8d6476beb32160a
MD5 68beba6548d424db2c86b501f5cd290a
BLAKE2b-256 08502fd7de034f46ff51cd694b9a7d5ce4eb9f8a474fd46af9cd35c9b692f0db

See more details on using hashes here.

Supported by

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