|
|
|
|
@ -35,38 +35,39 @@ class Comment(models.Model):
|
|
|
|
|
|
|
|
|
|
def save(self, *args, **kwargs):
|
|
|
|
|
super().save(*args, **kwargs)
|
|
|
|
|
subject = '感谢您发表的评论'
|
|
|
|
|
site = Site.objects.get_current().domain
|
|
|
|
|
article_url = "https://{site}{path}".format(site=site, path=self.article.get_absolute_url())
|
|
|
|
|
html_content = """
|
|
|
|
|
<p>非常感谢您在本站发表评论</p>
|
|
|
|
|
您可以访问
|
|
|
|
|
<a href="%s" rel="bookmark">%s</a>
|
|
|
|
|
来查看您的评论,
|
|
|
|
|
再次感谢您!
|
|
|
|
|
<br />
|
|
|
|
|
如果上面链接无法打开,请将此链接复制至浏览器。
|
|
|
|
|
%s
|
|
|
|
|
""" % (article_url, self.article.title, article_url)
|
|
|
|
|
tomail = self.author.email
|
|
|
|
|
msg = EmailMultiAlternatives(subject, html_content, from_email='no-reply@lylinux.net', to=[tomail])
|
|
|
|
|
|
|
|
|
|
msg.content_subtype = "html"
|
|
|
|
|
|
|
|
|
|
_thread.start_new_thread(self.send_comment_email, (msg,))
|
|
|
|
|
|
|
|
|
|
if self.parent_comment:
|
|
|
|
|
if not settings.DEBUG:
|
|
|
|
|
subject = '感谢您发表的评论'
|
|
|
|
|
site = Site.objects.get_current().domain
|
|
|
|
|
article_url = "https://{site}{path}".format(site=site, path=self.article.get_absolute_url())
|
|
|
|
|
html_content = """
|
|
|
|
|
您在 <a href="%s" rel="bookmark">%s</a> 的评论 <br/> %s <br/> 收到回复啦.快去看看吧
|
|
|
|
|
<br/>
|
|
|
|
|
<p>非常感谢您在本站发表评论</p>
|
|
|
|
|
您可以访问
|
|
|
|
|
<a href="%s" rel="bookmark">%s</a>
|
|
|
|
|
来查看您的评论,
|
|
|
|
|
再次感谢您!
|
|
|
|
|
<br />
|
|
|
|
|
如果上面链接无法打开,请将此链接复制至浏览器。
|
|
|
|
|
%s
|
|
|
|
|
""" % (article_url, self.article.title, self.parent_comment.body, article_url)
|
|
|
|
|
tomail = self.parent_comment.author.email
|
|
|
|
|
""" % (article_url, self.article.title, article_url)
|
|
|
|
|
tomail = self.author.email
|
|
|
|
|
msg = EmailMultiAlternatives(subject, html_content, from_email='no-reply@lylinux.net', to=[tomail])
|
|
|
|
|
|
|
|
|
|
msg.content_subtype = "html"
|
|
|
|
|
|
|
|
|
|
_thread.start_new_thread(self.send_comment_email, (msg,))
|
|
|
|
|
|
|
|
|
|
if self.parent_comment:
|
|
|
|
|
html_content = """
|
|
|
|
|
您在 <a href="%s" rel="bookmark">%s</a> 的评论 <br/> %s <br/> 收到回复啦.快去看看吧
|
|
|
|
|
<br/>
|
|
|
|
|
如果上面链接无法打开,请将此链接复制至浏览器。
|
|
|
|
|
%s
|
|
|
|
|
""" % (article_url, self.article.title, self.parent_comment.body, article_url)
|
|
|
|
|
tomail = self.parent_comment.author.email
|
|
|
|
|
msg = EmailMultiAlternatives(subject, html_content, from_email='no-reply@lylinux.net', to=[tomail])
|
|
|
|
|
msg.content_subtype = "html"
|
|
|
|
|
|
|
|
|
|
_thread.start_new_thread(self.send_comment_email, (msg,))
|
|
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.body
|
|
|
|
|
|