This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
from dav_base.emails import AbstractMail
|
||||
|
||||
|
||||
class AbstractRegistrationMail(AbstractMail):
|
||||
class AbstractRegistrationMail(AbstractMail): # pylint: disable=too-few-public-methods
|
||||
def __init__(self, recipient, registration):
|
||||
self._recipient = recipient
|
||||
self._registration = registration
|
||||
@@ -13,45 +13,45 @@ class AbstractRegistrationMail(AbstractMail):
|
||||
subject_fmt = self._subject
|
||||
|
||||
if self._event.number:
|
||||
subject_fmt = u'%s: %s' % (self._event.number, subject_fmt)
|
||||
subject_fmt = '%s: %s' % (self._event.number, subject_fmt)
|
||||
|
||||
return super(AbstractRegistrationMail, self)._get_subject(subject_fmt=subject_fmt, **kwargs)
|
||||
return super()._get_subject(subject_fmt=subject_fmt, **kwargs)
|
||||
|
||||
def _get_recipients(self):
|
||||
if hasattr(self._recipient, 'get_full_name') and hasattr(self._recipient, 'email'):
|
||||
r = u'"{fullname}" <{email}>'.format(fullname=self._recipient.get_full_name(),
|
||||
email=self._recipient.email)
|
||||
r = '"{fullname}" <{email}>'.format(fullname=self._recipient.get_full_name(),
|
||||
email=self._recipient.email)
|
||||
else:
|
||||
r = self._recipient
|
||||
return [r]
|
||||
|
||||
def _get_context_data(self, extra_context=None):
|
||||
context = super(AbstractRegistrationMail, self)._get_context_data(extra_context=extra_context)
|
||||
context = super()._get_context_data(extra_context=extra_context)
|
||||
context['recipient'] = self._recipient
|
||||
context['registration'] = self._registration
|
||||
context['event'] = self._event
|
||||
return context
|
||||
|
||||
|
||||
class InformTrainerRegistrationMail(AbstractRegistrationMail):
|
||||
_subject = u'Anmeldung {full_name}'
|
||||
class InformTrainerRegistrationMail(AbstractRegistrationMail): # pylint: disable=too-few-public-methods
|
||||
_subject = 'Anmeldung {full_name}'
|
||||
_template_name = 'dav_registration/emails/inform_trainer.txt'
|
||||
|
||||
def _get_subject(self, subject_fmt=None, **kwargs):
|
||||
kwargs['full_name'] = self._registration.get_full_name()
|
||||
return super(InformTrainerRegistrationMail, self)._get_subject(subject_fmt=subject_fmt, **kwargs)
|
||||
return super()._get_subject(subject_fmt=subject_fmt, **kwargs)
|
||||
|
||||
def _get_reply_to(self):
|
||||
s = u'"{fullname}" <{email}>'.format(fullname=self._registration.get_full_name(),
|
||||
email=self._registration.email_address)
|
||||
return [s]
|
||||
reply_to = '"{fullname}" <{email}>'.format(fullname=self._registration.get_full_name(),
|
||||
email=self._registration.email_address)
|
||||
return [reply_to]
|
||||
|
||||
|
||||
class InformSelfRegistrationMail(AbstractRegistrationMail):
|
||||
_subject = u'Deine Anmeldung'
|
||||
class InformSelfRegistrationMail(AbstractRegistrationMail): # pylint: disable=too-few-public-methods
|
||||
_subject = 'Deine Anmeldung'
|
||||
_template_name = 'dav_registration/emails/inform_self.txt'
|
||||
|
||||
def _get_reply_to(self):
|
||||
s = u'"{fullname}" <{email}>'.format(fullname=self._event.owner.get_full_name(),
|
||||
email=self._event.owner.email)
|
||||
return [s]
|
||||
reply_to = '"{fullname}" <{email}>'.format(fullname=self._event.owner.get_full_name(),
|
||||
email=self._event.owner.email)
|
||||
return [reply_to]
|
||||
|
||||
Reference in New Issue
Block a user