From 282e84e48af2196fdd87dbbbd9484c3887e03fc0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arthur=20Gu=C3=A9don?=
 <60623551+arthurgdn@users.noreply.github.com>
Date: Mon, 5 Oct 2020 18:49:00 +0200
Subject: [PATCH] Info form (#23)
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

* fixed email

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: Dylan Sechet <dylan.sechet82@gmail.com>
Co-authored-by: Seon82 <46298009+Seon82@users.noreply.github.com>
---
 oser_backend/settings/dev_sendgrid.py | 1 +
 profiles/models.py                    | 3 +--
 profiles/notifications.py             | 7 ++++++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/oser_backend/settings/dev_sendgrid.py b/oser_backend/settings/dev_sendgrid.py
index 868345b..468b0aa 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 bd2ab0e..6f9dd0d 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 d7fdfcd..bdd010b 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]
+
-- 
GitLab