Allow changing the project's website from a settings option. Update the default mailer templates to take the project title and website from the configuration settings.
This commit is contained in:
25
mayan/apps/mailer/literals.py
Normal file
25
mayan/apps/mailer/literals.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
DEFAULT_DOCUMENT_BODY_TEMPLATE =_('\
|
||||
Attached to this email is the document: {{ document }}<br /><br />\n\n\
|
||||
--------<br />\nThis email has been sent from \
|
||||
%(project_title)s (%(project_website)s)'
|
||||
) % {
|
||||
'project_title': settings.PROJECT_TITLE,
|
||||
'project_website': settings.PROJECT_WEBSITE
|
||||
}
|
||||
|
||||
DEFAULT_LINK_BODY_TEMPLATE = _('\
|
||||
To access this document click on the following link: \
|
||||
<a href="{{ link }}">{{ link }}</a><br /><br />\n\n--------<br />\
|
||||
\nThis email has been sent from %(project_title)s (%(project_website)s)\
|
||||
') % {
|
||||
'project_title': settings.PROJECT_TITLE,
|
||||
'project_website': settings.PROJECT_WEBSITE
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,14 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from smart_settings import Namespace
|
||||
|
||||
from .literals import (
|
||||
DEFAULT_DOCUMENT_BODY_TEMPLATE, DEFAULT_LINK_BODY_TEMPLATE
|
||||
)
|
||||
|
||||
|
||||
namespace = Namespace(name='mailer', label=_('Mailing'))
|
||||
setting_link_subject_template = namespace.add_setting(global_name='MAILER_LINK_SUBJECT_TEMPLATE', default=_('Link for document: {{ document }}'), help_text=_('Template for the document link email form subject line.'))
|
||||
setting_link_body_template = namespace.add_setting(global_name='MAILER_LINK_BODY_TEMPLATE', default=_('To access this document click on the following link: <a href="{{ link }}">{{ link }}</a><br /><br />\n\n--------<br />\nThis email has been sent from Mayan EDMS (http://www.mayan-edms.com)'), help_text=_('Template for the document link email form body line.'))
|
||||
setting_link_body_template = namespace.add_setting(global_name='MAILER_LINK_BODY_TEMPLATE', default=DEFAULT_LINK_BODY_TEMPLATE, help_text=_('Template for the document link email form body line.'))
|
||||
setting_document_subject_template = namespace.add_setting(global_name='MAILER_DOCUMENT_SUBJECT_TEMPLATE', default=_('Document: {{ document }}'), help_text=_('Template for the document email form subject line.'))
|
||||
setting_document_body_template = namespace.add_setting(global_name='MAILER_DOCUMENT_BODY_TEMPLATE', default=_('Attached to this email is the document: {{ document }}<br /><br />\n\n--------<br />\nThis email has been sent from Mayan EDMS (http://www.mayan-edms.com)'), help_text=_('Template for the document email form body line.'))
|
||||
setting_document_body_template = namespace.add_setting(global_name='MAILER_DOCUMENT_BODY_TEMPLATE', default=DEFAULT_DOCUMENT_BODY_TEMPLATE, help_text=_('Template for the document email form body line.'))
|
||||
|
||||
|
||||
@@ -151,6 +151,7 @@ STATIC_URL = '/static/'
|
||||
TEMPLATE_DEBUG = True
|
||||
PROJECT_TITLE = 'Mayan EDMS'
|
||||
PROJECT_NAME = 'mayan'
|
||||
PROJECT_WEBSITE = 'http://www.mayan-edms.com'
|
||||
|
||||
LANGUAGES = (
|
||||
('ar', _('Arabic')),
|
||||
|
||||
Reference in New Issue
Block a user