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>"},
|
"rappels": {"FROM": "Le BdA <bda@ens.fr>", "REPLYTO": "Le BdA <bda@ens.fr>"},
|
||||||
"rappel_negatif": {
|
"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": {
|
"revente": {
|
||||||
"FROM": "BdA-Revente <bda-revente@ens.fr>",
|
"FROM": "BdA-Revente <bda-revente@ens.fr>",
|
||||||
|
|
|
@ -2,7 +2,7 @@ import re
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User
|
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.core.validators import RegexValidator
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.db.models import F
|
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.
|
Envoie un mail de rappel signalant que la personne est en négatif.
|
||||||
"""
|
"""
|
||||||
# On envoie le mail
|
mail_data = settings.MAIL_DATA["rappel_negatif"]
|
||||||
send_mail(
|
|
||||||
"Compte K-Psul négatif",
|
email = EmailMessage(
|
||||||
loader.render_to_string(
|
subject="Compte K-Psul négatif",
|
||||||
|
body=loader.render_to_string(
|
||||||
"kfet/mails/rappel.txt",
|
"kfet/mails/rappel.txt",
|
||||||
context={
|
context={
|
||||||
"account": self.account,
|
"account": self.account,
|
||||||
|
@ -309,9 +310,14 @@ class AccountNegative(models.Model):
|
||||||
"start_date": self.start,
|
"start_date": self.start,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
settings.MAIL_DATA["rappel_negatif"]["FROM"],
|
from_email=mail_data["FROM"],
|
||||||
[self.account.email],
|
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
|
# On enregistre le fait que l'envoi a bien eu lieu
|
||||||
self.last_rappel = timezone.now()
|
self.last_rappel = timezone.now()
|
||||||
self.save()
|
self.save()
|
||||||
|
|
Loading…
Reference in a new issue