Correction de bugs et nettoyage

This commit is contained in:
Martin Pépin 2016-12-23 10:25:28 +01:00
parent b39806e171
commit 8bf2f715a4
5 changed files with 34 additions and 27 deletions

View file

@ -298,36 +298,35 @@ class SpectacleRevente(models.Model):
# Envoie un mail au gagnant et au vendeur
winner = random.choice(inscrits)
self.soldTo = winner
datatuple = []
context = {
'acheteur': winner.user,
'vendeur': seller.user,
'show': spectacle,
}
send_custom_mail(
datatuple.append((
'bda-revente-winner',
context,
settings.MAIL_DATA['revente']['FROM'],
[winner.user.email],
context=context,
from_email=settings.MAIL_DATA['revente']['FROM']
)
send_custom_mail(
))
datatuple.append((
'bda-revente-seller',
[seller.user.email],
context=context,
from_email=settings.MAIL_DATA['revente']['FROM']
)
context,
settings.MAIL_DATA['revente']['FROM'],
[seller.user.email]
))
# Envoie un mail aux perdants
datatuple = [(
for inscrit in inscrits:
if inscrit != winner:
context['acheteur'] = inscrit.user
datatuple.append((
'bda-revente-loser',
{
'acheteur': inscrit.user,
'vendeur': seller.user,
'show': spectacle
},
context,
settings.MAIL_DATA['revente']['FROM'],
[inscrit.user.email])
for inscrit in inscrits if inscrit != winner
]
[inscrit.user.email]
))
send_mass_custom_mail(datatuple)
# Si personne ne veut de la place, elle part au shotgun
else:

View file

@ -28,8 +28,12 @@
<h3>Forme des mails</h3>
<br />Une seule place<br /><br />
<pre>{{ exemple_mail_1place }}</pre>
{% for part in exemple_mail_1place %}
<pre>{{ part }}</pre>
{% endfor %}
<br />Deux places<br /><br />
<pre>{{ exemple_mail_2places }}</pre>
{% for part in exemple_mail_2places %}
<pre>{{ part }}</pre>
{% endfor %}
{% endblock %}

View file

@ -466,7 +466,7 @@ def buy_revente(request, spectacle_id):
}
send_custom_mail(
'bda-buy-shotgun',
[revente.seller.user.email],
recipient_list=[revente.seller.user.email],
context=context,
from_email='bda@ens.fr'
)
@ -575,7 +575,7 @@ def send_rappel(request, spectacle_id):
# Demande de confirmation
else:
ctxt['sent'] = False
return render(request, "mails-rappel.html", ctxt)
return render(request, "bda/mails-rappel.html", ctxt)
def descriptions_spectacles(request, tirage_id):

View file

@ -155,7 +155,7 @@ def _generate_eleve_email(demande, proposed_for):
render_custom_mail('petit-cours-mail-eleve', {
"demande": demande,
"matieres": matieres
})[1]
})
)
for user, matieres in proposed_for
]

View file

@ -30,10 +30,14 @@
<h4>Mails pour les membres proposés :</h4>
{% for proposeduser, mail in proposed_mails %}
<h5>Pour {{ proposeduser }}:</h5>
<pre>{{ mail }}</pre>
{% for part in mail %}
<pre>{{ part }}</pre>
{% endfor %}
{% endfor %}
<h4>Mail pour l'auteur de la demande :</h4>
<pre style="margin-top: 15px;">{{ mainmail|safe }}</pre>
{% for part in mainmail %}
<pre style="margin-top: 15px;">{{ part|safe }}</pre>
{% endfor %}
<input type="hidden" name="attribdata" value="{{ attribdata }}" />
{% if redo %}<input type="hidden" name="redo" value="1" />{% endif %}
<input class="btn btn-primary pull-right" type="submit" value="Valider le {% if redo %}re{% endif %}traitement de la demande" />