Skip to content
This repository has been archived by the owner on Jan 14, 2019. It is now read-only.

Commit

Permalink
Corrected the signals section to use post_save in the appropriate place.
Browse files Browse the repository at this point in the history
Also added site to the email context
  • Loading branch information
James Turnbull authored and James Turnbull committed Oct 23, 2008
1 parent 9581c1a commit b16e857
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions comment_utils/moderation.py
Expand Up @@ -323,8 +323,10 @@ def email(self, comment, content_object):
recipient_list = [manager_tuple[1] for manager_tuple in settings.MANAGERS]
t = loader.get_template('comment_utils/comment_notification_email.txt')
c = Context({ 'comment': comment,
'content_object': content_object })
subject = '[%s] New comment posted on "%s"' % (Site.objects.get_current().name,
'content_object': content_object,
'site': Site.objects.get_current(),
})
subject = '[%s] Comment: "%s"' % (Site.objects.get_current().name,
content_object)
message = t.render(c)
send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, recipient_list, fail_silently=True)
Expand Down Expand Up @@ -452,7 +454,7 @@ def connect(self):
"""
signals.pre_save.connect(self.pre_save_moderation, sender=comments.get_model())
signals.pre_save.connect(self.post_save_moderation, sender=comments.get_model())
signals.post_save.connect(self.post_save_moderation, sender=comments.get_model())

def register(self, model_or_iterable, moderation_class):
"""
Expand Down

0 comments on commit b16e857

Please sign in to comment.