Skip to content

Commit

Permalink
updated send_mail for publish notifications to send emails with html …
Browse files Browse the repository at this point in the history
…messages, updated template to use html as well
  • Loading branch information
rwblair committed Jan 12, 2016
1 parent f323a44 commit f4d3281
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
13 changes: 8 additions & 5 deletions open_fmri/apps/dataset/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ def save(self, *args, **kwargs):
notify = True
super(Dataset, self).save(*args, **kwargs)
if notify:
subject = "New dataset avaliable from OpenfMRI.org"
subject = "New dataset avaliable on OpenfMRI.org"
body = render_to_string(
"dataset/published_dataset_email_body.txt",
{'dataset': self, 'url': reverse('dataset_detail', self.pk)}
"dataset/published_dataset_email_body.html",
{
'dataset': self,
'url': reverse('dataset_detail', args=[self.pk])
}
)
send_mail(subject, body, "news@openfmri.org",
["openfmri_pub@lists.stanford.edu"], False)
send_mail(subject, "", "news@openfmri.org",
["openfmri_pub@lists.stanford.edu"], html_message=body)



Expand Down
14 changes: 14 additions & 0 deletions open_fmri/templates/dataset/published_dataset_email_body.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<html>
<body>
A new dataset is avaliable here: <a href="https://openfmri.org{{ url }}">https://openfmri.org{{ url }}</a><br>

<p>
Project Name: {{ dataset.project_name }}
</p>

<p>
Summary:<br>
{{ dataset.summary|safe }}
</p>
</body>
</html>

0 comments on commit f4d3281

Please sign in to comment.