views.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:SaBoT 作者: froscon 项目源码 文件源码
def change_notification(self, changed_fields):
        if len(changed_fields) == 0:
            return
        change_dict = {}
        for field in changed_fields:
            field_name = self.object.fieldDescriptionalNames.get(field,field)
            change_dict[field_name] = getattr(self.object,field)

        ctx_dict = {
            "sponsor" : self.object,
            "change_dict" : change_dict,
            "user" : self.request.user,
        }
        subject = "Sponsor information change notification"
        message = render_to_string('sponsor/change_notification_email.txt', ctx_dict)
        send_mail(subject,message,settings.DEFAULT_FROM_EMAIL,settings.SPONSOR_NOTIFICATION,fail_silently=True)

        if "clearedForBilling" in changed_fields and self.object.clearedForBilling == True:
            subject = "Sponsoring ready for billing"
            message = render_to_string('sponsor/ready_for_billing_notification_email.txt', ctx_dict)
            send_mail(subject,message,settings.DEFAULT_FROM_EMAIL,settings.FINANCE_EMAIL,fail_silently=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号