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)
评论列表
文章目录