The BdA receives the reminder emails

This commit is contained in:
Martin Pépin 2017-06-02 17:25:04 +01:00
parent 5bed02c3fc
commit 0e03fc85ee
2 changed files with 15 additions and 5 deletions

View file

@ -0,0 +1,10 @@
from django.contrib.auth.models import User
def get_generic_user():
generic, created = User.objects.get_or_create(username="bda_generic")
if created:
generic.email = "bda@ens.fr"
generic.first_name = "Bureau des Arts"
generic.save()
return generic

View file

@ -11,6 +11,8 @@ from django.contrib.auth.models import User
from django.conf import settings
from django.utils import timezone, formats
from . import get_generic_user
class Tirage(models.Model):
title = models.CharField("Titre", max_length=300)
@ -104,11 +106,9 @@ class Spectacle(models.Model):
members[member.id][1] = 2
else:
members[member.id] = [member, 1]
# FIXME : faire quelque chose de ça, un utilisateur bda_generic ?
# # Pour le BdA
# members[0] = ['BdA', 1, 'bda@ens.fr']
# members[-1] = ['BdA', 2, 'bda@ens.fr']
# On écrit un mail personnalisé à chaque participant
bda_generic = get_generic_user()
members[-1] = [bda_generic, 1]
datatuple = [(
'bda-rappel',
{'member': member[0], 'nb_attr': member[1], 'show': self},
@ -121,7 +121,7 @@ class Spectacle(models.Model):
self.rappel_sent = timezone.now()
self.save()
# On renvoie la liste des destinataires
return members.values()
return map(lambda t: t[0], members.values())
@property
def is_past(self):