From 1dd7018870729f84220a5ab2c22c362d7d7581a0 Mon Sep 17 00:00:00 2001 From: Seon82 <46298009+Seon82@users.noreply.github.com> Date: Mon, 5 Oct 2020 17:47:48 +0200 Subject: [PATCH] Envoi email (#22) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Password reset feature (#8) * Add Django Rest auth module * Try to make the send reset password email work * Modified template mail for reset * Add Django Rest auth module * Try to make the send reset password email work * Modified template mail for reset * test * Ajouté API student * API GET sans authentification * Added POST support * POST API fix * Fixed charfields length in wiki * loosen security * simplify API serialized data * Implemented partial_update * Added special teaching and nationality to serializer * dependantsNumber to int * Fixed factory imports * Added write auth and minor serializer fix * Added read permissions * Read permissions that work? * Actually added read permissions? * Updated tests to pass travis * Updated tests * Fixed all factory tests * Adapté les tests à la nouvelle structure de Student * Created StaffUserFactory and finished fixing tests * Update README.md * Added classType * Fixed migrations * Added last modified year & filters in admin interface * Email notification Co-authored-by: chiahetcho <44137047+chiahetcho@users.noreply.github.com> Co-authored-by: florimondmanca <florimond.manca@gmail.com> Co-authored-by: Dylan Sechet <dylan.sechet@student-cs.fr> Co-authored-by: Arthur Guédon <arthur.guedon@student-cs.fr> Co-authored-by: Arthur Guédon <60623551+arthurgdn@users.noreply.github.com> --- profiles/models.py | 6 ++++++ profiles/notifications.py | 6 ++++++ .../templates/profiles/registration_docs.md | 18 ++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 profiles/notifications.py create mode 100644 profiles/templates/profiles/registration_docs.md diff --git a/profiles/models.py b/profiles/models.py index 675354d..bd2ab0e 100644 --- a/profiles/models.py +++ b/profiles/models.py @@ -6,6 +6,9 @@ from dry_rest_permissions.generics import authenticated_users from .utils import get_promotion_range from datetime import datetime +from .notifications import SendDocs + + class ProfileMixin: """Mixin with common functionnality for profiles.""" @@ -188,6 +191,9 @@ class Student(ProfileMixin, models.Model): self.year = f"{date_now.year}/{date_now.year+1}" else: self.year = f"{date_now.year-1}/{date_now.year}" + + SendDocs().send() # send email with link to registration docs + return super(Student,self).save(*args, **kwargs) class Meta: # noqa diff --git a/profiles/notifications.py b/profiles/notifications.py new file mode 100644 index 0000000..d7fdfcd --- /dev/null +++ b/profiles/notifications.py @@ -0,0 +1,6 @@ +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 diff --git a/profiles/templates/profiles/registration_docs.md b/profiles/templates/profiles/registration_docs.md new file mode 100644 index 0000000..bf90ad9 --- /dev/null +++ b/profiles/templates/profiles/registration_docs.md @@ -0,0 +1,18 @@ +{% extends 'mails/notification.md' %} + +{% block greeting %} +Bonjour, +{% endblock %} + +{% block body %} +Si tu reçois ce mail c’est que tu as fait un compte sur le site d’OSER et que tu as correctement rempli tes données personnelles. Félicitations ! ✅ + +Avant de te laisser tranquille et que tu aies accès aux inscriptions pour les sorties et les projets, il te reste une dernière tâche : remplir le dossier d’inscription. Tu peux le trouver à ce lien : [https://drive.google.com/drive/folders/1TSGPRP2dAu07nkucpioWYGToccSU2vLD?usp=sharing](https://drive.google.com/drive/folders/1TSGPRP2dAu07nkucpioWYGToccSU2vLD?usp=sharing) . +Tu peux télécharger le document et l’imprimer. Si tu n’as pas d’imprimante tu peux demander un dossier papier à un tuteur de ta séance. Il faut rendre ce dossier sous format papier rempli aux tuteurs de ta séance. Dès que l’on recevra ton dossier, on validera ton compte ! +{% endblock %} + +{% block signature %} +On espère passer une super année avec toi, + +L’équipe OSER +{% endblock %} \ No newline at end of file -- GitLab