我正在使用 Django 的 contrib.comments 并想了解以下内容。
是否有任何实用程序或应用程序可以插入到某个应用程序中,当对某个项目发表评论时向您发送通知?
我并没有真正使用过那么多信号,所以请稍微描述一下。
这是我想出来的。
from django.contrib.comments.signals import comment_was_posted
from django.core.mail import send_mail
if "notification" in settings.INSTALLED_APPS:
from notification import models as notification
def comment_notification(request):
user = request.user
message = "123"
notification.send([user], "new comment", {'message': message,})
comment_was_posted.connect(comment_notification)
最佳答案
将 django.contrib.comments.signals.comment_was_posted
连接到 notification
.models.send()
视情况而定。
关于关于提交评论的 Django 通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3804248/