Commit a30de002 by Őry Máté

dashboard: add EMAIL_SUBJECT_PREFIX to notifications

parent 8bc53a3b
...@@ -79,6 +79,8 @@ ADMINS = ( ...@@ -79,6 +79,8 @@ ADMINS = (
('Root', 'root@localhost'), ('Root', 'root@localhost'),
) )
EMAIL_SUBJECT_PREFIX = get_env_variable('DJANGO_SUBJECT_PREFIX', '[CIRCLE] ')
# See: https://docs.djangoproject.com/en/dev/ref/settings/#managers # See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
MANAGERS = ADMINS MANAGERS = ADMINS
########## END MANAGER CONFIGURATION ########## END MANAGER CONFIGURATION
......
...@@ -86,7 +86,7 @@ class Profile(Model): ...@@ -86,7 +86,7 @@ class Profile(Model):
use_gravatar = BooleanField(default=False) use_gravatar = BooleanField(default=False)
email_notifications = BooleanField( email_notifications = BooleanField(
verbose_name=_("Email notifications"), default=True, verbose_name=_("Email notifications"), default=True,
help_text=_('Wether user wants to get digested email notifications.')) help_text=_('Whether user wants to get digested email notifications.'))
def notify(self, subject, template, context={}, valid_until=None): def notify(self, subject, template, context={}, valid_until=None):
return Notification.send(self.user, subject, template, context, return Notification.send(self.user, subject, template, context,
......
...@@ -51,7 +51,8 @@ def send_email_notifications(): ...@@ -51,7 +51,8 @@ def send_email_notifications():
'url': (settings.DJANGO_URL.rstrip("/") + 'url': (settings.DJANGO_URL.rstrip("/") +
reverse("dashboard.views.notifications")), reverse("dashboard.views.notifications")),
'site': settings.COMPANY_NAME} 'site': settings.COMPANY_NAME}
subject = ungettext("%d new notification", subject = settings.EMAIL_SUBJECT_PREFIX + ungettext(
"%d new notification",
"%d new notifications", len(msgs)) % len(msgs) "%d new notifications", len(msgs)) % len(msgs)
body = render_to_string('dashboard/notifications/email.txt', body = render_to_string('dashboard/notifications/email.txt',
context) context)
......
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 sign in to comment