Commit 28465be5 authored by Alice's avatar Alice

Add mail template for broken link.

parent fd283ba3
......@@ -301,3 +301,22 @@ def update_review(sender, instance, created, **kwargs):
resource.submitter.email,
[resource.submitter.email]
)
@receiver(post_save, sender=BrokenLink)
def sendMailToResourceSubmitter(sender, instance, created, **kwargs):
if created:
if instance:
brokenLink = instance
message = loader.render_to_string(
'report_broken_link.txt',
{
'brokenlink': instance,
}
)
send_mail(
'The resource you submitted has a brokenlink',
message,
brokenLink.resource.submitter.email,
[brokenLink.resource.submitter.email]
)
Hello {{brokenlink.resource.submitter.name}}
{{brokenlink.submitter.name|safe}} ({{brokenlink.submitter.email}}) is reporting you that the following resource you submit has a broken link :
Title: {{brokenlink.resource.name}}
Description: {{brokenlink.resource.description}}
URI: {{brokenlink.resource.uri}}
Have a nice day,
The Knowledge Base Team.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment