django-model-event-actions |latest-version|
|python-support| |django-support| |pypi| |license|
.. start docs include
This package is a replacement for the builtin Django_ Signals which you can define all of the events and actions in the model itself and add conditions to determine when they are triggered. With the help of this package you can track the changed field previous and current values and determine when an action should trigger by creating an event with the decorators in the model.
A simple example will be:
.. code-block:: python
class User(EventActionModel):
is_active = models.BooleanField()
@PostSaveEvent(field='is_active', prev=False, now=True)
def user_deactivated(self):
# logic
@PostCreateEvent()
def post_create(self):
# logic
.. end docs include
.. |latest-version| image:: https://img.shields.io/badge/version-1.1-green
:alt: Latest version on PyPI
:target: https://pypi.org/project/django-model-event-actions/
.. |python-support| image:: https://img.shields.io/badge/python-%2B3.6-blue
:target: https://pypi.org/project/django-model-event-actions/
:alt: Python version
.. |django-support| image:: https://img.shields.io/badge/django-%2B2.1-blue
:target: https://pypi.org/project/django-model-event-actions/
:alt: Django versions
.. |pypi| image:: https://img.shields.io/badge/pypi-1.1-blue
:target: https://pypi.org/project/django-model-event-actions/
:alt: Pypi link
.. |license| image:: https://img.shields.io/badge/license-MIT-green
:alt: Software license
:target: https://github.com/aryabartar/django-model-event-actions/blob/master/LICENSE
.. _Django: http://www.djangoproject.com/
Installation ++++++++++++
.. start installation include
Get the package from pypi::
$ pip install django-model-event-actions
Subclass the models:
.. code-block:: python
from django_model_event_actions.models import EventActionModel
class MyClass(EventActionModel):
...
Add the event decorator:
.. code-block:: python
from django_model_event_actions.models import EventActionModel
class MyClass(EventActionModel):
name = models.CharField()
@PostCreateEvent(field='name'):
def my_handler(self):
# logic
.. end installation include
Tutorial ++++++++
To start using the package take a look at the documentation_ in readthedocs.
.. _documentation: http://www.djangoproject.com/
Release files for django-model-event-actions 1.0.4
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-model-event-actions-1.0.4.tar.gz | 10.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_model_event_actions-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.3 kB
Release files / django-model-event-actions-1.0.4.tar.gz
| Download URL | django-model-event-actions-1.0.4.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
258db2afbbca2654cfe0bbff8ca9649443b07c243555d1c0f24a064c3b8ae866
|
|
BLAKE2b-256 checksum How to use checksums |
5727a2c4b6befc8095eb7e9c5adec2d41c945e2acf72be8e564f43491bab685b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.2
|
Release files / django_model_event_actions-1.0.4-py3-none-any.whl
| Download URL | django_model_event_actions-1.0.4-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0093e827d22a59570f10bb02f2c04b66be666b14cee939bfdb254424ebb9c3fa
|
|
BLAKE2b-256 checksum How to use checksums |
ac067014aa58950c1b2dd00e52faccf3f4827826d8ad6e705349a930f4e29dd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.2
|