From 7b738361bfac4132c3b563e0922d318d65909d38 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Wed, 25 Jan 2017 21:06:32 +0100 Subject: Ajout d'un mail de confirmation de désinscription --- templates/mail/mail_unsubscribed.txt | 2 ++ views.py | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 templates/mail/mail_unsubscribed.txt diff --git a/templates/mail/mail_unsubscribed.txt b/templates/mail/mail_unsubscribed.txt new file mode 100644 index 0000000..d5c5df2 --- /dev/null +++ b/templates/mail/mail_unsubscribed.txt @@ -0,0 +1,2 @@ +Vous avez été désabonné de l'emploi du temps {{ group.timetable.name }} - {{ group.name }} +Notez que si vous vous êtes abonné à un autre emploi du temps, vous recevrez toujours les mails de ceux-ci. diff --git a/views.py b/views.py index 8813187..24473d1 100644 --- a/views.py +++ b/views.py @@ -79,6 +79,11 @@ def confirm_subscription(request, token): def cancel_subscription(request, token): subscription = get_object_or_404(Subscription, token=token) + group = subscription.group subscription.delete() + template = loader.get_template("mail/mail_unsubscribed.txt") + context = Context({"group": group}) + send_mail("Confirmation de la désinscription", template.render(context), settings.DEFAULT_FROM_EMAIL, [subscription.email]) + return redirect("index") -- cgit v1.2.1