* Only set notification emails when DEBUG is disabled.
[matthijs/projects/xerxes.git] / influences / notify.py
1 from django.db.models import signals
2 from django.dispatch import dispatcher
3 from django.conf import settings
4 from ee.influences.models import Character,Influence
5 from ee.tools.notify import notify
6 from django.contrib.auth.models import Group
7
8 def character_saved(instance, created):
9     if (not settings.DEBUG):
10         notify([instance.player, 'lextalionis@evolution-events.nl'], 'influences/email/character_changed.html', {'character' : instance, 'created' : created})
11
12 dispatcher.connect(character_saved, signals.post_save, Character)
13
14 def influence_saved(instance, created):
15     if (not settings.DEBUG):
16         # TODO: Perhaps only notify when the status is / becomes Done?
17         notify([instance.character.player, 'lextalionis@evolution-events.nl'], 'influences/email/influence_changed.html', {'influence' : instance, 'created' : created})
18
19 dispatcher.connect(influence_saved, signals.post_save, Influence)
20 # vim: set sts=4 sw=4 expandtab: