* Send an email to the player when a character is modified.
[matthijs/projects/xerxes.git] / influences / notify.py
diff --git a/influences/notify.py b/influences/notify.py
new file mode 100644 (file)
index 0000000..3cbb94e
--- /dev/null
@@ -0,0 +1,10 @@
+from django.db.models import signals
+from django.dispatch import dispatcher
+from ee.influences.models import Character,Influence
+from ee.tools.notify import notify
+from django.contrib.auth.models import Group
+
+def character_saved(instance, created):
+    notify(instance.player, 'influences/email/character_changed', {'character' : instance, 'created' : created})
+
+dispatcher.connect(character_saved, signals.post_save, Character)