Skip to content

Commit

Permalink
Test environment email backend setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Mihálik committed Aug 21, 2024
1 parent d99ae37 commit 35e7502
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
8 changes: 4 additions & 4 deletions competition/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
rank_results)
from personal.models import Profile, School
from personal.serializers import ProfileExportSerializer, SchoolSerializer
from webstrom.settings import EMAIL_ALERT, EMAIL_NO_REPLY
from webstrom.settings import EMAIL_ALERT

# pylint: disable=unused-argument

Expand Down Expand Up @@ -154,7 +154,7 @@ def publish(self, request, pk=None):
send_mail(
'Zverejnený komentár',
render_to_string('competition/emails/comment_published.txt'),
EMAIL_NO_REPLY,
None,
[comment.posted_by.email],
)

Expand All @@ -171,7 +171,7 @@ def hide(self, request, pk=None):
send_mail(
'Skrytý komentár',
render_to_string('competition/emails/comment_hidden.txt'),
EMAIL_NO_REPLY,
None,
[comment.posted_by.email],
)

Expand Down Expand Up @@ -231,7 +231,7 @@ def add_comment(self, request, pk=None):
send_mail(
'Nový komentár',
render_to_string('competition/emails/comment_added.txt'),
EMAIL_NO_REPLY,
None,
[EMAIL_ALERT],
)

Expand Down
4 changes: 2 additions & 2 deletions user/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from personal.models import Profile
from personal.serializers import ProfileCreateSerializer
from user.models import TokenModel
from webstrom.settings import EMAIL_ALERT, EMAIL_NO_REPLY
from webstrom.settings import EMAIL_ALERT


def reset_password_url_generator(request, user, temp_key):
Expand Down Expand Up @@ -172,7 +172,7 @@ def handle_other_school(self, school):
'school_info': school_info
},
),
EMAIL_NO_REPLY,
None,
[EMAIL_ALERT]
)

Expand Down
4 changes: 2 additions & 2 deletions webstrom/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@

EMAIL_VERIFICATION_TIMEOUT = 86400

MANAGERS = [('Web', 'web@strom.sk'), ]
MANAGERS = [('Web', 'webmaster@strom.sk'), ]

EMAIL_NO_REPLY = 'no-reply@strom.sk' # z tade sa odosielaju maily
DEFAULT_FROM_EMAIL = 'noreply@strom.sk' # z tade sa odosielaju maily
EMAIL_ALERT = '[email protected]' # tu sa prijimaju maily
5 changes: 5 additions & 0 deletions webstrom/settings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@
}

EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"

EMAIL_HOST = "smtp-relay.gmail.com"
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_TIMEOUT = 10

0 comments on commit 35e7502

Please sign in to comment.