gpt4 book ai didi

关于提交评论的 Django 通知

转载 作者:行者123 更新时间:2023-12-03 21:45:18 30 4
gpt4 key购买 nike

我正在使用 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/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com