Events watcher is an event packaging library for Django to track changes made in your models.
Add new events for auth.users:
In : from events_watcher.bridge import backend as events In : user = User.objects.create_user('newbie', 'firstname.lastname@example.org', '$ecret') In : events.add('subscription', user) Out: <Event: subscription for newbie> In : events.add('subscription', user, date=user.date_joined) Out: <Event: subscription for newbie>
List all events for auth.users:
In : events.list(user) Out: [<Event: subscription for newbie>, <Event: subscription for newbie>] In : events.add('last_login', user, date=user.last_login) Out: <Event: last_login for newbie> In : events.list('last_login') Out: [<Event: last_login for newbie>]
Retrieve only one event for a specific event name and auth.users:
In : events.retrieve('last_login', user) Out: <Event: last_login for newbie>
Remove all events with a specific event name:
In : events.remove('last_login')
This library is compatible with:
python setup.py install
put the events_watcher folder on your python-path
Add events_watcher.backends.database to your INSTALLED_APPS if you want to use the RDMS backend connector with the Django ORM.
Currently only databases shipped with the default Django ORM is supported and the API is very simple.
Custom backends could be done to store results in NoSQL databases like: redis or MongoDB.
events_watcher uses a load_class helper in its utils module which can be found at django-shop.