diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7cd01b0e80c02c4334b61dcef75ad44fdc9068fb..cc14961373ee965b2b3e308c6a159ab6de0ca38c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog`_, and this project adheres to `Semantic Versioning`_. +Unreleased +---------- + +Added +~~~~~ + +* Allow to configure email notification recipient for events + `1.3.2`_ -------- diff --git a/aleksis/apps/paweljong/models.py b/aleksis/apps/paweljong/models.py index 1cd803879f3c27f4c7bc43b1daaf3767327cfccb..976b74470226a61ccf67a24835c5833388e64230 100644 --- a/aleksis/apps/paweljong/models.py +++ b/aleksis/apps/paweljong/models.py @@ -108,7 +108,11 @@ class Event(ExtensibleModel): information = RichTextField(verbose_name=_("Information about the event")) terms = models.ManyToManyField(Terms, verbose_name=_("Terms"), related_name="event", blank=True) info_mailings = models.ManyToManyField( - InfoMailing, verbose_name=_("Info mailings"), related_name="events", through="EventInfoMailingThrough", blank=True + InfoMailing, + verbose_name=_("Info mailings"), + related_name="events", + through="EventInfoMailingThrough", + blank=True, ) def save(self, *args, **kwargs): diff --git a/aleksis/apps/paweljong/preferences.py b/aleksis/apps/paweljong/preferences.py new file mode 100644 index 0000000000000000000000000000000000000000..a3a9a2c205fcf17f44c10da0902dc93e9b198a8d --- /dev/null +++ b/aleksis/apps/paweljong/preferences.py @@ -0,0 +1,22 @@ +from django.conf import settings +from django.forms import EmailField +from django.utils.translation import gettext_lazy as _ + +from dynamic_preferences.preferences import Section +from dynamic_preferences.types import StringPreference + +from aleksis.core.registries import site_preferences_registry + +paweljong = Section("paweljong", verbose_name=_("Paweljong")) + + +@site_preferences_registry.register +class EventNotificationRecipient(StringPreference): + """Mail recipient for event nofications (e.g. registrations).""" + + section = paweljong + name = "event_notification_recipient" + default = settings.ADMINS[0][1] + verbose_name = _("Mail recipient for event notifications") + field_class = EmailField + required = True diff --git a/aleksis/apps/paweljong/views.py b/aleksis/apps/paweljong/views.py index efe2fee8e039f6022e85d02c56cad1ceaeb64477..429f4c1f8601320917fa06eacd6edb6d5aa582ee 100644 --- a/aleksis/apps/paweljong/views.py +++ b/aleksis/apps/paweljong/views.py @@ -651,12 +651,13 @@ class RegisterEventWizardView(SessionWizardView): send_templated_mail( template_name="event_registered", from_email=get_site_preferences()["mail__address"], - recipient_list=["orga@teckids.org"], + recipient_list=get_site_prefenreces()["paweljong__event_notification_recipient"], headers={ "reply_to": [ person.email, person.guardians.first().email, ], + "X-Zammad-Customer-Email": person.email, }, context=context, )