From 80f6a808dcddba03dec43b67b625f6c698b158e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Sun, 18 Jun 2017 17:03:50 +0100 Subject: [PATCH] Simplify the mails-rappel view --- bda/templates/bda/mails-rappel.html | 2 +- bda/views.py | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/bda/templates/bda/mails-rappel.html b/bda/templates/bda/mails-rappel.html index 342b24a6..c10503b0 100644 --- a/bda/templates/bda/mails-rappel.html +++ b/bda/templates/bda/mails-rappel.html @@ -28,7 +28,7 @@

Note : le template de ce mail peut être modifié à - cette adresse + cette adresse


diff --git a/bda/views.py b/bda/views.py index 2149594a..d6da2e9f 100644 --- a/bda/views.py +++ b/bda/views.py @@ -6,9 +6,7 @@ import hashlib import time import json from datetime import timedelta -from custommail.shortcuts import ( - send_mass_custom_mail, send_custom_mail, render_custom_mail -) +from custommail.shortcuts import send_mass_custom_mail, send_custom_mail from custommail.models import CustomMail from django.shortcuts import render, get_object_or_404 from django.contrib.auth.decorators import login_required @@ -652,28 +650,23 @@ def unpaid(request, tirage_id): def send_rappel(request, spectacle_id): show = get_object_or_404(Spectacle, id=spectacle_id) # 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, 'show': show, 'nb_attr': 1 }) - exemple_mail_2places = render_custom_mail('bda-rappel', { + exemple_mail_2places = custommail.render({ 'member': request.user, 'show': show, 'nb_attr': 2 }) # Contexte - custommail_id = ( - CustomMail.objects - .filter(shortname="bda-rappel") - .values_list("id", flat=True) - [0] - ) ctxt = { 'show': show, 'exemple_mail_1place': exemple_mail_1place, 'exemple_mail_2places': exemple_mail_2places, - 'custommail_id': custommail_id, + 'custommail': custommail, } # Envoi confirmé if request.method == 'POST':