Metadata-Version: 2.0
Name: django-terminator
Version: 0.1.0
Summary: One time method executor for Django models
Home-page: http://github.com/KrzysiekJ/django-terminator
Author: Krzysztof Jurewicz
Author-email: krzysztof.jurewicz@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7

=================
django-terminator
=================

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.


