One time method executor for Django models
Project description
One-time execution of Django model methods, when model instance meets specific conditions.
Examples
import datetime
from django.db import models
from django.db.models import Q
from terminator import execute_once
class Message(models.Model):
sent = models.BooleanField(default=False)
sender_email = models.EmailField()
recipient_email = models.EmailField()
subject = models.CharField(max_length=128)
body = models.TextField()
@execute_once(Q())
def send(self):
# Some code which sends the email…
pass
class BirthdayGift(models.Model):
birthday_date = models.DateField()
@execute_once(lambda cls: Q(birthday_date__lte=datetime.date.today()))
def send(self):
# Some code which sends the gift…
pass
Later:
from terminator import terminate terminate()
For more extensive documentation, see the tests.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-terminator-0.1.1.tar.gz.
File metadata
- Download URL: django-terminator-0.1.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cf1dec565a6070b310013a1de7ce3713af9b5f41ab1abe3b4296abec7a6ad06
|
|
| MD5 |
b27c906951b3870031db4227c7f557d2
|
|
| BLAKE2b-256 |
d08dcb67810f47efcad7b67f30a9ad77181b140ca1e24ea3161ca6690b2bb0bc
|
File details
Details for the file django_terminator-0.1.1-py27-none-any.whl.
File metadata
- Download URL: django_terminator-0.1.1-py27-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 2.7
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f34f0c29306b7b420f9f28f8749c60592e2819dce1c5f6abaddd1bd9e2034b8c
|
|
| MD5 |
c1da39655f753aeb055431854697da72
|
|
| BLAKE2b-256 |
6a66c067bff7dd9b8677ee233fac203d4a5a84d7158bbeaec770f8f50db93ca6
|