diff --git a/oser_backend/settings/dev_sendgrid.py b/oser_backend/settings/dev_sendgrid.py index 868345b995a13c8bd6d99d56dc48cee8a9ea87b9..468b0aa3277bd7fb2f300f556e6781920fb0f145 100644 --- a/oser_backend/settings/dev_sendgrid.py +++ b/oser_backend/settings/dev_sendgrid.py @@ -5,3 +5,4 @@ from .dev import * # Allow to send emails with SendGrid while in DEBUG mode. # See: https://github.com/sklarsa/django-sendgrid-v5#other-settings SENDGRID_SANDBOX_MODE_IN_DEBUG = False + diff --git a/profiles/models.py b/profiles/models.py index bd2ab0efb650caac8a36a08bfbe3895143653589..6f9dd0dafe33d456124e641e49b78175b2b085ed 100644 --- a/profiles/models.py +++ b/profiles/models.py @@ -5,7 +5,6 @@ from django.shortcuts import reverse from dry_rest_permissions.generics import authenticated_users from .utils import get_promotion_range from datetime import datetime - from .notifications import SendDocs @@ -192,7 +191,7 @@ class Student(ProfileMixin, models.Model): else: self.year = f"{date_now.year-1}/{date_now.year}" - SendDocs().send() # send email with link to registration docs + SendDocs(user=self.user).send() # send email with link to registration docs return super(Student,self).save(*args, **kwargs) diff --git a/profiles/notifications.py b/profiles/notifications.py index d7fdfcd9e2f08dc2bee61e81043fa4fd230ad3be..bdd010bc663b378239b51d14bb18ddcb951685dd 100644 --- a/profiles/notifications.py +++ b/profiles/notifications.py @@ -3,4 +3,9 @@ from mails import Notification class SendDocs(Notification): """Sends a link to the google docs containing the registration documents""" subject = "Dossier d'inscription OSER" - template_name = "profiles/registration_docs.md" \ No newline at end of file + + template_name = "profiles/registration_docs.md" + args = ('user',) + def get_recipients(self): + return [self.user.email] +