Self hosted FLOSS fitness/workout, nutrition and weight tracker
Move EMAIL_FROM to settings file
Roland Geidercd59bea4abfb
diff --git a/wger/exercises/models.py b/wger/exercises/models.pyindex 187a89716..f4ed03d31 100644--- a/wger/exercises/models.py+++ b/wger/exercises/models.py@@ -31,11 +31,11 @@ from django.core.urlresolvers import reversefrom django.core import mailfrom django.core.cache import cachefrom django.core.validators import MinLengthValidator+from django.conf import settingsfrom wger.core.models import Languagefrom wger.utils.managers import SubmissionManagerfrom wger.utils.models import AbstractLicenseModel, AbstractSubmissionModel-from wger.utils.constants import EMAIL_FROMfrom wger.utils.cache import (delete_template_fragment_cache,reset_workout_canonical_form,@@ -315,7 +315,7 @@ class Exercise(AbstractSubmissionModel, AbstractLicenseModel, models.Model):message = render_to_string('exercise/email_new.html', context)mail.send_mail(subject,message,- EMAIL_FROM,+ settings.EMAIL_FROM,[user.email],fail_silently=True)diff --git a/wger/gym/management/commands/inactive-members.py b/wger/gym/management/commands/inactive-members.pyindex fecca69f3..008243c0f 100644--- a/wger/gym/management/commands/inactive-members.py+++ b/wger/gym/management/commands/inactive-members.py@@ -21,8 +21,8 @@ from django.utils import translationfrom django.utils.translation import ugettext as _from django.core.management.base import BaseCommandfrom django.template.loader import render_to_string+from django.conf import settings-from wger.utils.constants import EMAIL_FROMfrom wger.gym.helpers import is_any_gym_adminfrom wger.gym.helpers import get_user_last_activityfrom wger.gym.models import Gym@@ -101,6 +101,6 @@ class Command(BaseCommand):message = render_to_string('gym/email_inactive_members.html', context)mail.send_mail(subject,message,- EMAIL_FROM,+ settings.EMAIL_FROM,[trainer.email],fail_silently=True)diff --git a/wger/manager/management/commands/email-reminders.py b/wger/manager/management/commands/email-reminders.pyindex 06b7c383c..134a1243e 100644--- a/wger/manager/management/commands/email-reminders.py+++ b/wger/manager/management/commands/email-reminders.py@@ -21,11 +21,11 @@ from django.core.management.base import BaseCommandfrom django.core import mailfrom django.utils.translation import ugettext_lazy as _from django.utils import translation+from django.conf import settingsfrom django.contrib.sites.models import Sitefrom wger.core.models import UserProfilefrom wger.manager.models import Schedule-from wger.utils.constants import EMAIL_FROMclass Command(BaseCommand):@@ -122,6 +122,6 @@ class Command(BaseCommand):message = loader.render_to_string('workout/email_reminder.tpl', context)mail.send_mail(subject,message,- EMAIL_FROM,+ settings.EMAIL_FROM,[user.email],fail_silently=True)diff --git a/wger/nutrition/models.py b/wger/nutrition/models.pyindex c306024bc..c5436f401 100644--- a/wger/nutrition/models.py+++ b/wger/nutrition/models.py@@ -30,9 +30,10 @@ from django.contrib.auth.models import Userfrom django.utils.encoding import python_2_unicode_compatiblefrom django.utils.translation import ugettext_lazy as _from django.utils import translation+from django.conf import settingsfrom wger.core.models import Language-from wger.utils.constants import EMAIL_FROM, TWOPLACES+from wger.utils.constants import TWOPLACESfrom wger.utils.cache import cache_mapperfrom wger.utils.fields import Html5TimeFieldfrom wger.utils.models import AbstractLicenseModel@@ -429,7 +430,7 @@ class Ingredient(AbstractLicenseModel, models.Model):message = render_to_string('ingredient/email_new.html', context)mail.send_mail(subject,message,- EMAIL_FROM,+ settings.EMAIL_FROM,[self.user.email],fail_silently=True)diff --git a/wger/settings.tpl b/wger/settings.tplindex a68fc87e1..e85ee5bf1 100644--- a/wger/settings.tpl+++ b/wger/settings.tpl@@ -55,4 +55,7 @@ ALLOWED_HOSTS = '*'# Configure a real backend in productionif DEBUG:- EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'\ No newline at end of file+ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'++# Sender address used for sent emails+EMAIL_FROM = 'wger Workout Manager <[email protected]>'\ No newline at end of filediff --git a/wger/utils/constants.py b/wger/utils/constants.pyindex caf3cf5b3..d62f01726 100644--- a/wger/utils/constants.py+++ b/wger/utils/constants.py@@ -59,7 +59,3 @@ HTML_STYLES_WHITELIST = ('text-decoration',)PAGINATION_OBJECTS_PER_PAGE = 25PAGINATION_MAX_TOTAL_PAGES = 10PAGINATION_PAGES_AROUND_CURRENT = 5---EMAIL_FROM = 'wger Workout Manager <[email protected]>'diff --git a/wger/weight/management/commands/email-weight-reminder.py b/wger/weight/management/commands/email-weight-reminder.pyindex ff83e5007..9cb64596d 100644--- a/wger/weight/management/commands/email-weight-reminder.py+++ b/wger/weight/management/commands/email-weight-reminder.py@@ -21,11 +21,11 @@ from django.core.management.base import BaseCommandfrom django.core import mailfrom django.utils.translation import ugettext_lazy as _from django.utils import translation+from django.conf import settingsfrom django.contrib.sites.models import Sitefrom wger.core.models import UserProfilefrom wger.weight.models import WeightEntry-from wger.utils.constants import EMAIL_FROMclass Command(BaseCommand):@@ -79,6 +79,6 @@ class Command(BaseCommand):message = loader.render_to_string('workout/email_weight_reminder.tpl', context)mail.send_mail(subject,message,- EMAIL_FROM,+ settings.EMAIL_FROM,[user.email],fail_silently=True)