def save(self, *args, **kwargs): notify = not self.id super(TypedComment, self).save(*args, **kwargs) if notify: post = self.content_object ctx = { 'comment': self, 'post': post, } # Internal comments go to publishers and editors if self.comment_type == 'internal': subject = _('New internal comment') email_helpers.send_publishers_authors_email(subject, 'send_notification_new_int_comment.txt', ctx) else: subject = _('New comment') ## Improbable generic foreign key filters would work users = set([post.author]) if post.co_author: users.add(post.co_author) commentators = auth_models.User.objects.filter(id__in=set([p.user.id for p in post.comments.all()])) for commentator in commentators: users.add(commentator) for user in users: email_helpers.send_user_email(user, subject, 'send_notification_new_ext_comment.txt', ctx)