Add settings value for automatic emails

Resolves #54
This commit is contained in:
Jan Tuomi
2017-05-29 23:26:36 +03:00
parent 0a3e10d1c3
commit 5c8dfdfd1d
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -509,6 +509,9 @@ def send_mail_wrapper(subject, message, email_to):
@receiver(post_save, sender=Request)
def email_on_request(sender, instance, created, **kwargs):
if not settings.ENABLE_AUTOMATIC_EMAILS:
return
try:
if created:
subject = 'Test1'
@@ -520,6 +523,9 @@ def email_on_request(sender, instance, created, **kwargs):
@receiver(post_save, sender=Member)
def email_on_accept(sender, instance, created, **kwargs):
if not settings.ENABLE_AUTOMATIC_EMAILS:
return
try:
if created:
subject = 'Test2'
+1 -1
View File
@@ -158,7 +158,7 @@ EMAIL_PORT = 587
EMAIL_HOST_USER = '<gmailtunnarisi>@gmail.com'
EMAIL_HOST_PASSWORD = '<gmail_passu>'
DEFAULT_EMAIL_FROM = 'SIK Viestintä <sikviestinta@gmail.com>'
ENABLE_AUTOMATIC_EMAILS = False
# ReCaptcha
# http://www.yaconiello.com/blog/integrating-google-recaptcha-to-django/