Move EMAIL_FROM to WGER_SETTINGS dictionary

This makes the behaviour more consistent, as there are already application
specifig configurations there.
This commit is contained in:
Roland Geider
2015-12-03 23:10:11 +01:00
parent 2789ad7098
commit 05306b9123
8 changed files with 11 additions and 7 deletions

View File

@@ -19,6 +19,9 @@ dictionary in your settings file. Currently the following options are supported:
middleware instead. Read the django documentation on the security implications
(BREACH attack).
**EMAIL_FROM**: Default `wger Workout Manager <wger@example.com>`
The sender address used for sent emails by the system such as weight reminders
.. note::
If you want to override a default setting, don't overwrite all the dictionary

View File

@@ -315,7 +315,7 @@ class Exercise(AbstractSubmissionModel, AbstractLicenseModel, models.Model):
message = render_to_string('exercise/email_new.html', context)
mail.send_mail(subject,
message,
settings.EMAIL_FROM,
settings.WGER_SETTINGS['EMAIL_FROM'],
[user.email],
fail_silently=True)

View File

@@ -101,6 +101,6 @@ class Command(BaseCommand):
message = render_to_string('gym/email_inactive_members.html', context)
mail.send_mail(subject,
message,
settings.EMAIL_FROM,
settings.WGER_SETTINGS['EMAIL_FROM'],
[trainer.email],
fail_silently=True)

View File

@@ -122,6 +122,6 @@ class Command(BaseCommand):
message = loader.render_to_string('workout/email_reminder.tpl', context)
mail.send_mail(subject,
message,
settings.EMAIL_FROM,
settings.WGER_SETTINGS['EMAIL_FROM'],
[user.email],
fail_silently=True)

View File

@@ -430,7 +430,7 @@ class Ingredient(AbstractLicenseModel, models.Model):
message = render_to_string('ingredient/email_new.html', context)
mail.send_mail(subject,
message,
settings.EMAIL_FROM,
settings.WGER_SETTINGS['EMAIL_FROM'],
[self.user.email],
fail_silently=True)

View File

@@ -58,4 +58,4 @@ if DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# Sender address used for sent emails
EMAIL_FROM = 'wger Workout Manager <your.email@example.com>'
WGER_SETTINGS['EMAIL_FROM'] = 'wger Workout Manager <wger@example.com>'

View File

@@ -348,5 +348,6 @@ IGNORABLE_404_URLS = (
WGER_SETTINGS = {
'USE_RECAPTCHA': False,
'REMOVE_WHITESPACE': False,
'ALLOW_REGISTRATION': True
'ALLOW_REGISTRATION': True,
'EMAIL_FROM': 'wger Workout Manager <wger@example.com>'
}

View File

@@ -79,6 +79,6 @@ class Command(BaseCommand):
message = loader.render_to_string('workout/email_weight_reminder.tpl', context)
mail.send_mail(subject,
message,
settings.EMAIL_FROM,
settings.WGER_SETTINGS['EMAIL_FROM'],
[user.email],
fail_silently=True)