Browse Source

[enh] Document settings

ljf 6 years ago
parent
commit
7774ebb161
3 changed files with 11 additions and 7 deletions
  1. 1 0
      README.md
  2. 7 7
      coin/members/models.py
  3. 3 0
      coin/settings_base.py

+ 1 - 0
README.md

@@ -351,6 +351,7 @@ List of available settings in your `settings_local.py` file.
 - `MEMBER_CAN_EDIT_VPN_CONF`: Allow members to edit some part of their vpn configuration
 - `DEBUG` : Enable debug for development **do not use in production** : display
    stracktraces and enable [django-debug-toolbar](https://django-debug-toolbar.readthedocs.io).
+- `NOTIFICATION_EMAILS` : Emails on which to send notifications.
 
 Accounting logs
 ---------------

+ 7 - 7
coin/members/models.py

@@ -45,13 +45,13 @@ def send_registration_notification(sender, user, request=None, **kwargs):
     """
     relative_link = reverse('admin:members_member_change', args=[user.id])
     edit_link = request.build_absolute_uri(relative_link)
-
-    utils.send_templated_email(
-        to=settings.NOTIFICATION_EMAILS,
-        subject_template='members/emails/new_member_subject.txt',
-        body_template='members/emails/new_member_email.html',
-        context={'member': self, 'edit_link': edit_link},
-        **kwargs)
+    if settings.NOTIFICATION_EMAILS is not None:
+        utils.send_templated_email(
+            to=settings.NOTIFICATION_EMAILS,
+            subject_template='members/emails/new_member_subject.txt',
+            body_template='members/emails/new_member_email.html',
+            context={'member': self, 'edit_link': edit_link},
+            **kwargs)
 
 
 class Member(CoinLdapSyncMixin, AbstractUser):

+ 3 - 0
coin/settings_base.py

@@ -16,6 +16,9 @@ ADMINS = (
     # ('Your Name', 'your_email@example.com'),
 )
 
+# Email on which to send emails
+NOTIFICATION_EMAILS = None
+
 MANAGERS = ADMINS
 
 DATABASES = {