+
+
+
+def notify_new_comment(sender, instance, created, **kwargs):
+ if (created and isinstance(instance.content_object, Entry) and
+ instance.content_object.author_email):
+ site = Site.objects.get_current()
+ mail_text = loader.get_template('migdal/mail/new_comment.txt').render(
+ Context({
+ 'comment': instance,
+ 'site': site,
+ }))
+ send_mail(
+ ugettext(u'New comment under your story at %s.') % site.domain,
+ mail_text, settings.SERVER_EMAIL,
+ [instance.content_object.author_email]
+ )
+models.signals.post_save.connect(notify_new_comment, sender=XtdComment)
\ No newline at end of file