From 873836c8871c7d090c5a01dce9f935aab1139f14 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 23 Jun 2015 04:12:39 -0400 Subject: [PATCH] Update remaining mailer app to new smart settings system --- mayan/apps/mailer/forms.py | 12 ++++++------ mayan/apps/mailer/settings.py | 17 ++++++----------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/mayan/apps/mailer/forms.py b/mayan/apps/mailer/forms.py index f02b2f1aa6..046ed74cf0 100644 --- a/mayan/apps/mailer/forms.py +++ b/mayan/apps/mailer/forms.py @@ -4,8 +4,8 @@ from django import forms from django.utils.translation import ugettext_lazy as _ from .settings import ( - DOCUMENT_BODY_TEMPLATE, DOCUMENT_SUBJECT_TEMPLATE, LINK_BODY_TEMPLATE, - LINK_SUBJECT_TEMPLATE + setting_document_body_template, setting_document_subject_template, + setting_link_body_template, setting_link_subject_template ) @@ -14,11 +14,11 @@ class DocumentMailForm(forms.Form): as_attachment = kwargs.pop('as_attachment', False) super(DocumentMailForm, self).__init__(*args, **kwargs) if as_attachment: - self.fields['subject'].initial = DOCUMENT_SUBJECT_TEMPLATE - self.fields['body'].initial = DOCUMENT_BODY_TEMPLATE + self.fields['subject'].initial = setting_document_subject_template.value + self.fields['body'].initial = setting_document_body_template.value else: - self.fields['subject'].initial = LINK_SUBJECT_TEMPLATE - self.fields['body'].initial = LINK_BODY_TEMPLATE + self.fields['subject'].initial = setting_link_subject_template.value + self.fields['body'].initial = setting_link_body_template.value email = forms.EmailField(label=_('Email address')) subject = forms.CharField(label=_('Subject'), required=False) diff --git a/mayan/apps/mailer/settings.py b/mayan/apps/mailer/settings.py index 35bb3434ff..4da6266404 100644 --- a/mayan/apps/mailer/settings.py +++ b/mayan/apps/mailer/settings.py @@ -2,15 +2,10 @@ from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ -from smart_settings.api import register_settings +from smart_settings import Namespace -register_settings( - namespace='mailer', - module='mailer.settings', - settings=[ - {'name': 'LINK_SUBJECT_TEMPLATE', 'global_name': 'MAILER_LINK_SUBJECT_TEMPLATE', 'default': _('Link for document: {{ document }}'), 'description': _('Template for the document link email form subject line.')}, - {'name': 'LINK_BODY_TEMPLATE', 'global_name': 'MAILER_LINK_BODY_TEMPLATE', 'default': _('To access this document click on the following link: {{ link }}

\n\n--------
\nThis email has been sent from Mayan EDMS (http://www.mayan-edms.com)'), 'description': _('Template for the document link email form body line.')}, - {'name': 'DOCUMENT_SUBJECT_TEMPLATE', 'global_name': 'MAILER_DOCUMENT_SUBJECT_TEMPLATE', 'default': _('Document: {{ document }}'), 'description': _('Template for the document email form subject line.')}, - {'name': 'DOCUMENT_BODY_TEMPLATE', 'global_name': 'MAILER_DOCUMENT_BODY_TEMPLATE', 'default': _('Attached to this email is the document: {{ document }}

\n\n--------
\nThis email has been sent from Mayan EDMS (http://www.mayan-edms.com)'), 'description': _('Template for the document email form body line.')}, - ] -) +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: {{ link }}

\n\n--------
\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_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 }}

\n\n--------
\nThis email has been sent from Mayan EDMS (http://www.mayan-edms.com)'), help_text=_('Template for the document email form body line.'))