From c8f5dd0467fc7593eeeee0ba5748a5a8006e3134 Mon Sep 17 00:00:00 2001 From: Fergal Moran Date: Fri, 3 May 2013 14:48:59 +0100 Subject: [PATCH] Added some email templates --- dss/settings.py | 5 +++-- spa/models/userprofile.py | 2 +- templates/notification/email_body.txt | 6 ++++++ templates/notification/new_follower/full.txt | 1 + templates/notification/new_follower/notice.html | 7 +++++++ templates/notification/new_follower/short.txt | 1 + 6 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 templates/notification/email_body.txt create mode 100644 templates/notification/new_follower/full.txt create mode 100644 templates/notification/new_follower/notice.html create mode 100644 templates/notification/new_follower/short.txt diff --git a/dss/settings.py b/dss/settings.py index b926537..90002cf 100644 --- a/dss/settings.py +++ b/dss/settings.py @@ -261,8 +261,9 @@ mimetypes.add_type("text/xml", ".plist", False) HTML_MINIFY = not localsettings.DEBUG EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' -EMAIL_HOST = 'localhost' -EMAIL_PORT = 1025 + +EMAIL_HOST = localsettings.EMAIL_HOST +EMAIL_PORT = localsettings.EMAIL_PORT if DEBUG: import mimetypes diff --git a/spa/models/userprofile.py b/spa/models/userprofile.py index 9ebec83..5553959 100644 --- a/spa/models/userprofile.py +++ b/spa/models/userprofile.py @@ -89,7 +89,7 @@ class UserProfile(_BaseModel): def add_follower(self, user): self.followers.add(user) try: - notification.send([self.user], "new_follower", {"from_user": "admin@deepsouthsounds.com"}) + notification.send([self.user], "new_follower", {"profile": user}) except Exception, ex: self.logger.warning("Unable to send email for new follower") self.logger.warning("Host: %s" % settings.EMAIL_HOST) diff --git a/templates/notification/email_body.txt b/templates/notification/email_body.txt new file mode 100644 index 0000000..91bc1ae --- /dev/null +++ b/templates/notification/email_body.txt @@ -0,0 +1,6 @@ +{% load i18n %}{% load url from future %}{% url "notification_notices" as notices_url %}{% blocktrans %}You have received the following notice from {{ current_site }}: + +{{ message }} + +To see other notices change how you receive notifications, please go to {{ default_http_protocol }}://{{ current_site }}/me +{% endblocktrans %} \ No newline at end of file diff --git a/templates/notification/new_follower/full.txt b/templates/notification/new_follower/full.txt new file mode 100644 index 0000000..8ffcfba --- /dev/null +++ b/templates/notification/new_follower/full.txt @@ -0,0 +1 @@ +{{ profile.get_nice_name }} has started following you. diff --git a/templates/notification/new_follower/notice.html b/templates/notification/new_follower/notice.html new file mode 100644 index 0000000..9bcdbb6 --- /dev/null +++ b/templates/notification/new_follower/notice.html @@ -0,0 +1,7 @@ +{% load i18n %} +{% url invitations as invitation_page %} +{% url profile_detail username=invitation.from_user.username as user_url %} +{% blocktrans with invitation.from_user as invitation_from_user %} + {{ invitation_from_user }} has started following you on Deep South Sounds + (see followers) +{% endblocktrans %} \ No newline at end of file diff --git a/templates/notification/new_follower/short.txt b/templates/notification/new_follower/short.txt new file mode 100644 index 0000000..7b2e35d --- /dev/null +++ b/templates/notification/new_follower/short.txt @@ -0,0 +1 @@ +{% load i18n %}{% blocktrans %}{{ notice }}{% endblocktrans %}