forked from DGNum/gestioCOF
Simplify the mails-rappel view
This commit is contained in:
parent
69aee6b8ac
commit
80f6a808dc
2 changed files with 6 additions and 13 deletions
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<em>Note :</em> le template de ce mail peut être modifié à
|
<em>Note :</em> le template de ce mail peut être modifié à
|
||||||
<a href="{% url 'admin:custommail_custommail_change' custommail_id %}">cette adresse</a>
|
<a href="{% url 'admin:custommail_custommail_change' custommail.pk %}">cette adresse</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<hr \>
|
<hr \>
|
||||||
|
|
17
bda/views.py
17
bda/views.py
|
@ -6,9 +6,7 @@ import hashlib
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from custommail.shortcuts import (
|
from custommail.shortcuts import send_mass_custom_mail, send_custom_mail
|
||||||
send_mass_custom_mail, send_custom_mail, render_custom_mail
|
|
||||||
)
|
|
||||||
from custommail.models import CustomMail
|
from custommail.models import CustomMail
|
||||||
from django.shortcuts import render, get_object_or_404
|
from django.shortcuts import render, get_object_or_404
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
@ -652,28 +650,23 @@ def unpaid(request, tirage_id):
|
||||||
def send_rappel(request, spectacle_id):
|
def send_rappel(request, spectacle_id):
|
||||||
show = get_object_or_404(Spectacle, id=spectacle_id)
|
show = get_object_or_404(Spectacle, id=spectacle_id)
|
||||||
# Mails d'exemples
|
# Mails d'exemples
|
||||||
exemple_mail_1place = render_custom_mail('bda-rappel', {
|
custommail = CustomMail.objects.get(shortname="bda-rappel")
|
||||||
|
exemple_mail_1place = custommail.render({
|
||||||
'member': request.user,
|
'member': request.user,
|
||||||
'show': show,
|
'show': show,
|
||||||
'nb_attr': 1
|
'nb_attr': 1
|
||||||
})
|
})
|
||||||
exemple_mail_2places = render_custom_mail('bda-rappel', {
|
exemple_mail_2places = custommail.render({
|
||||||
'member': request.user,
|
'member': request.user,
|
||||||
'show': show,
|
'show': show,
|
||||||
'nb_attr': 2
|
'nb_attr': 2
|
||||||
})
|
})
|
||||||
# Contexte
|
# Contexte
|
||||||
custommail_id = (
|
|
||||||
CustomMail.objects
|
|
||||||
.filter(shortname="bda-rappel")
|
|
||||||
.values_list("id", flat=True)
|
|
||||||
[0]
|
|
||||||
)
|
|
||||||
ctxt = {
|
ctxt = {
|
||||||
'show': show,
|
'show': show,
|
||||||
'exemple_mail_1place': exemple_mail_1place,
|
'exemple_mail_1place': exemple_mail_1place,
|
||||||
'exemple_mail_2places': exemple_mail_2places,
|
'exemple_mail_2places': exemple_mail_2places,
|
||||||
'custommail_id': custommail_id,
|
'custommail': custommail,
|
||||||
}
|
}
|
||||||
# Envoi confirmé
|
# Envoi confirmé
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
Loading…
Reference in a new issue