Made email subject prefix configurable.

This commit is contained in:
2018-02-21 11:31:17 +01:00
parent 5bb2edc749
commit f85683d0ac
3 changed files with 129 additions and 123 deletions

View File

@@ -6,6 +6,7 @@ DEFAULT_SETTINGS = (
DefaultSetting('enable_email_notifications', False),
DefaultSetting('email_sender', None),
DefaultSetting('email_base_url', None),
DefaultSetting('email_subject_prefix', ''),
DefaultSetting('group_manage_all', None),
DefaultSetting('group_manage_w', None),
DefaultSetting('group_manage_s', None),
@@ -15,8 +16,8 @@ DEFAULT_SETTINGS = (
DefaultSetting('group_publish', None),
DefaultSetting('group_publish_incremental', None),
DefaultSetting('forms_development_init', False),
DefaultSetting('matrix_config', ImproperlyConfigured),
DefaultSetting('form_initials', dict()),
DefaultSetting('matrix_config', ImproperlyConfigured),
)

View File

@@ -4,8 +4,9 @@ from dav_events.config import FieldInitial
# E-Mails
ENABLE_EMAIL_NOTIFICATIONS = False
EMAIL_SENDER = 'DAV Veranstaltungsheinzel <heinzel@heinzelwerk.de>'
EMAIL_SENDER = 'DAV Veranstaltungsheinzel <heinzel@alpenverein-karlsruhe.de>'
EMAIL_BASE_URL = 'http://localhost:8000'
EMAIL_SUBJECT_PREFIX = u'[DAV Veranstaltungen]'
# Authorization Roles / Groups
GROUP_MANAGE_ALL = 'Tourenreferenten'
@@ -17,119 +18,7 @@ GROUP_MANAGE_B = 'Bergsteigerreferenten'
GROUP_PUBLISH = 'Redaktion'
GROUP_PUBLISH_INCREMENTAL = 'OnlineRedaktion'
# EventCreateForm
# FORMS_DEVELOPMENT_INIT = False
MATRIX_CONFIG = {
'0': {'description': _(u'Keiner / direkte Abrechnung (Tageswanderung)'),
'trainer_fee': 0,
'pre_meeting_fee': 0,
'trainer_day_fee': 0,
'participant_fee': 0,
'participant_day_fee': 0,
'min_participants': 0,
'max_participants': 0,
},
'A': {'description': _(u'A (Mehrtageswanderung Mittelgebirge'),
'trainer_fee': 40,
'trainer_day_fee': 50,
'participant_fee': 10,
'participant_day_fee': 10,
'pre_meeting_fee': 0,
'min_participants': 5,
'max_participants': 8,
},
'B': {'description': _(u'B (Alpine Mehrtageswanderung)'),
'trainer_fee': 50,
'trainer_day_fee': 75,
'participant_fee': 10,
'participant_day_fee': 20,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 6,
},
'C': {'description': _(u'C (Tour/Kurs ohne Übernachtung)'),
'trainer_fee': 30,
'trainer_day_fee': 60,
'participant_fee': 10,
'participant_day_fee': 30,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 5,
},
'D': {'description': _(u'D (Tour/Kurs Mittelgebirge)'),
'trainer_fee': 50,
'trainer_day_fee': 75,
'participant_fee': 20,
'participant_day_fee': 25,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 5,
},
'E': {'description': _(u'E (Alpine Klettertour DE/AT)'),
'trainer_fee': 80,
'trainer_day_fee': 75,
'participant_fee': 40,
'participant_day_fee': 40,
'pre_meeting_fee': 0,
'min_participants': 2,
'max_participants': 3,
},
'F': {'description': _(u'F (Alpine Klettertour CH/FR/IT/..)'),
'trainer_fee': 80,
'trainer_day_fee': 85,
'participant_fee': 40,
'participant_day_fee': 45,
'pre_meeting_fee': 0,
'min_participants': 2,
'max_participants': 3,
},
'G': {'description': _(u'G (Alpiner Kurs DE/AT)'),
'trainer_fee': 100,
'trainer_day_fee': 75,
'participant_fee': 35,
'participant_day_fee': 30,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 4,
},
'H': {'description': _(u'H (Alpiner Kurs CH/FR/IT/..)'),
'trainer_fee': 100,
'trainer_day_fee': 85,
'participant_fee': 35,
'participant_day_fee': 30,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 4,
},
'I': {'description': _(u'I (Alpine MTB/Ski-Tour DE/AT)'),
'trainer_fee': 80,
'trainer_day_fee': 75,
'participant_fee': 25,
'participant_day_fee': 25,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 6,
},
'J': {'description': _(u'J (Alpine MTB/Ski-Tour CH/FR/IT/..)'),
'trainer_fee': 80,
'trainer_day_fee': 85,
'participant_fee': 25,
'participant_day_fee': 25,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 6,
},
'K': {'description': _(u'K (Ski-Tour/-Kurs mit Liftbenutzung)'),
'trainer_fee': 80,
'trainer_day_fee': 130,
'participant_fee': 40,
'participant_day_fee': 40,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 4,
},
}
# ChainedForm and sub classes
FORM_INITIALS = {
'ModeForm': {
'mode': FieldInitial('joint'),
@@ -272,3 +161,116 @@ FORM_INITIALS = {
),
},
}
# EventCreateForm and sub classes
# FORMS_DEVELOPMENT_INIT = False
MATRIX_CONFIG = {
'0': {'description': _(u'Keiner / direkte Abrechnung (Tageswanderung)'),
'trainer_fee': 0,
'pre_meeting_fee': 0,
'trainer_day_fee': 0,
'participant_fee': 0,
'participant_day_fee': 0,
'min_participants': 0,
'max_participants': 0,
},
'A': {'description': _(u'A (Mehrtageswanderung Mittelgebirge'),
'trainer_fee': 40,
'trainer_day_fee': 50,
'participant_fee': 10,
'participant_day_fee': 10,
'pre_meeting_fee': 0,
'min_participants': 5,
'max_participants': 8,
},
'B': {'description': _(u'B (Alpine Mehrtageswanderung)'),
'trainer_fee': 50,
'trainer_day_fee': 75,
'participant_fee': 10,
'participant_day_fee': 20,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 6,
},
'C': {'description': _(u'C (Tour/Kurs ohne Übernachtung)'),
'trainer_fee': 30,
'trainer_day_fee': 60,
'participant_fee': 10,
'participant_day_fee': 30,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 5,
},
'D': {'description': _(u'D (Tour/Kurs Mittelgebirge)'),
'trainer_fee': 50,
'trainer_day_fee': 75,
'participant_fee': 20,
'participant_day_fee': 25,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 5,
},
'E': {'description': _(u'E (Alpine Klettertour DE/AT)'),
'trainer_fee': 80,
'trainer_day_fee': 75,
'participant_fee': 40,
'participant_day_fee': 40,
'pre_meeting_fee': 0,
'min_participants': 2,
'max_participants': 3,
},
'F': {'description': _(u'F (Alpine Klettertour CH/FR/IT/..)'),
'trainer_fee': 80,
'trainer_day_fee': 85,
'participant_fee': 40,
'participant_day_fee': 45,
'pre_meeting_fee': 0,
'min_participants': 2,
'max_participants': 3,
},
'G': {'description': _(u'G (Alpiner Kurs DE/AT)'),
'trainer_fee': 100,
'trainer_day_fee': 75,
'participant_fee': 35,
'participant_day_fee': 30,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 4,
},
'H': {'description': _(u'H (Alpiner Kurs CH/FR/IT/..)'),
'trainer_fee': 100,
'trainer_day_fee': 85,
'participant_fee': 35,
'participant_day_fee': 30,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 4,
},
'I': {'description': _(u'I (Alpine MTB/Ski-Tour DE/AT)'),
'trainer_fee': 80,
'trainer_day_fee': 75,
'participant_fee': 25,
'participant_day_fee': 25,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 6,
},
'J': {'description': _(u'J (Alpine MTB/Ski-Tour CH/FR/IT/..)'),
'trainer_fee': 80,
'trainer_day_fee': 85,
'participant_fee': 25,
'participant_day_fee': 25,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 6,
},
'K': {'description': _(u'K (Ski-Tour/-Kurs mit Liftbenutzung)'),
'trainer_fee': 80,
'trainer_day_fee': 130,
'participant_fee': 40,
'participant_day_fee': 40,
'pre_meeting_fee': 0,
'min_participants': 3,
'max_participants': 4,
},
}

View File

@@ -32,11 +32,15 @@ def get_recipients(task, sport=None):
class AbstractMail(object):
_sender = app_config.settings.email_sender
_subject = 'Generic Mail'
_subject = u''
_template_name = None
def _get_subject(self, **kwargs):
return self._subject.format(**kwargs)
s = self._subject
if app_config.settings.email_subject_prefix:
s = u'%s %s' % (app_config.settings.email_subject_prefix, s)
s.format(**kwargs)
return s
def _get_template(self):
if not self._template_name:
@@ -73,7 +77,6 @@ class AbstractMail(object):
class AbstractEventMail(AbstractMail):
_subject = u'[DAV Veranstaltungen]'
_template_name = 'dav_events/emails/default.txt'
def __init__(self, recipient, event):
@@ -97,7 +100,7 @@ class NewEventMail(AbstractEventMail):
def _get_subject(self, **kwargs):
s = super(NewEventMail, self)._get_subject(**kwargs)
s += u' Neue Veranstaltung angelegt'
s += u'Neue Veranstaltung angelegt'
return s
@@ -115,7 +118,7 @@ class EventToAcceptMail(AbstractEventMail):
def _get_subject(self, **kwargs):
s = super(EventToAcceptMail, self)._get_subject(**kwargs)
s += u' Neue Veranstaltung freigeben'
s += u'Neue Veranstaltung freigeben'
return s
@@ -124,7 +127,7 @@ class EventAcceptedMail(AbstractEventMail):
def _get_subject(self, **kwargs):
s = super(EventAcceptedMail, self)._get_subject(**kwargs)
s += u' Veranstaltung wurde freigegeben'
s += u'Veranstaltung wurde freigegeben'
return s
@@ -133,12 +136,12 @@ class EventToPublishMail(AbstractEventMail):
def _get_subject(self, **kwargs):
s = super(EventToPublishMail, self)._get_subject(**kwargs)
s += u' Veranstaltung veröffentlichen'
s += u'Veranstaltung veröffentlichen'
return s
class PasswordSetEmail(AbstractMail):
_subject = u'[DAV Veranstaltungen] Zugangsdaten'
_subject = u'Zugangsdaten'
_template_name = 'dav_events/emails/password_set.txt'
def __init__(self, user, password):