forked from DGNum/gestioCOF
Merge branch 'send_neg' into 'master'
feat(kfet): Change l'adresse utilisée pour envoyer les mails de négatif See merge request klub-dev-ens/gestioCOF!526
This commit is contained in:
commit
a72302291f
2 changed files with 15 additions and 8 deletions
|
@ -207,7 +207,8 @@ MAIL_DATA = {
|
|||
},
|
||||
"rappels": {"FROM": "Le BdA <bda@ens.fr>", "REPLYTO": "Le BdA <bda@ens.fr>"},
|
||||
"rappel_negatif": {
|
||||
"FROM": "La K-Fêt <k-fet@ens.fr>",
|
||||
"FROM": "La K-Fêt <chefs-k-fet@ens.fr>",
|
||||
"REPLYTO": "La K-Fêt <chefs-k-fet@ens.fr>",
|
||||
},
|
||||
"revente": {
|
||||
"FROM": "BdA-Revente <bda-revente@ens.fr>",
|
||||
|
|
|
@ -2,7 +2,7 @@ import re
|
|||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.mail import send_mail
|
||||
from django.core.mail import EmailMessage
|
||||
from django.core.validators import RegexValidator
|
||||
from django.db import models, transaction
|
||||
from django.db.models import F
|
||||
|
@ -298,10 +298,11 @@ class AccountNegative(models.Model):
|
|||
"""
|
||||
Envoie un mail de rappel signalant que la personne est en négatif.
|
||||
"""
|
||||
# On envoie le mail
|
||||
send_mail(
|
||||
"Compte K-Psul négatif",
|
||||
loader.render_to_string(
|
||||
mail_data = settings.MAIL_DATA["rappel_negatif"]
|
||||
|
||||
email = EmailMessage(
|
||||
subject="Compte K-Psul négatif",
|
||||
body=loader.render_to_string(
|
||||
"kfet/mails/rappel.txt",
|
||||
context={
|
||||
"account": self.account,
|
||||
|
@ -309,9 +310,14 @@ class AccountNegative(models.Model):
|
|||
"start_date": self.start,
|
||||
},
|
||||
),
|
||||
settings.MAIL_DATA["rappel_negatif"]["FROM"],
|
||||
[self.account.email],
|
||||
from_email=mail_data["FROM"],
|
||||
to=[self.account.email],
|
||||
reply_to=[mail_data["REPLYTO"]],
|
||||
)
|
||||
|
||||
# On envoie le mail
|
||||
email.send()
|
||||
|
||||
# On enregistre le fait que l'envoi a bien eu lieu
|
||||
self.last_rappel = timezone.now()
|
||||
self.save()
|
||||
|
|
Loading…
Reference in a new issue