dav_submission: added email notification, zip-download and permission
check.
This commit is contained in:
32
dav_submission/emails.py
Normal file
32
dav_submission/emails.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from django.apps import apps
|
||||
|
||||
from dav_base.emails import AbstractMail
|
||||
|
||||
app_config = apps.get_containing_app_config(__package__)
|
||||
|
||||
|
||||
class NewSubmissionMail(AbstractMail):
|
||||
_subject = u'Neuer Beitrag: {title}'
|
||||
_template_name = 'dav_submission/emails/new_submission.txt'
|
||||
|
||||
def __init__(self, metadata):
|
||||
self._metadata = metadata
|
||||
|
||||
def _get_subject(self, subject_fmt=None, **kwargs):
|
||||
kwargs['title'] = self._metadata['title']
|
||||
return super(NewSubmissionMail, self)._get_subject(subject_fmt=subject_fmt, **kwargs)
|
||||
|
||||
def _get_reply_to(self):
|
||||
s = u'"{fullname}" <{email}>'.format(fullname=self._metadata['name'],
|
||||
email=self._metadata['email_address'])
|
||||
return [s]
|
||||
|
||||
def _get_recipients(self):
|
||||
r = app_config.settings.notify_address
|
||||
return [r]
|
||||
|
||||
def _get_context_data(self, extra_context=None):
|
||||
context = super(NewSubmissionMail, self)._get_context_data(extra_context=extra_context)
|
||||
context['metadata'] = self._metadata
|
||||
return context
|
||||
Reference in New Issue
Block a user