From 018f493b163b4326897ae4478ca782458997ceca Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Mon, 3 Oct 2016 14:47:13 +0200 Subject: [PATCH 1/2] fix date writing --- bda/management/commands/manage_reventes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bda/management/commands/manage_reventes.py b/bda/management/commands/manage_reventes.py index f45357b1..5fa3806b 100644 --- a/bda/management/commands/manage_reventes.py +++ b/bda/management/commands/manage_reventes.py @@ -14,7 +14,7 @@ class Command(BaseCommand): def handle(self, *args, **options): now = timezone.now() - self.stdout.write(now) + self.stdout.write(now.__str__()) reventes = SpectacleRevente.objects.all() for revente in reventes: # Check si < 24h From 7fbf0e48091ed19e199bd48a682472acc503d885 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Mon, 3 Oct 2016 16:47:22 +0200 Subject: [PATCH 2/2] fix manage_reventes --- bda/management/commands/manage_reventes.py | 4 +++- bda/models.py | 4 ++-- bda/templates/mail-revente.txt | 2 +- bda/templates/mail-shotgun.txt | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bda/management/commands/manage_reventes.py b/bda/management/commands/manage_reventes.py index 5fa3806b..45b9c91a 100644 --- a/bda/management/commands/manage_reventes.py +++ b/bda/management/commands/manage_reventes.py @@ -14,7 +14,6 @@ class Command(BaseCommand): def handle(self, *args, **options): now = timezone.now() - self.stdout.write(now.__str__()) reventes = SpectacleRevente.objects.all() for revente in reventes: # Check si < 24h @@ -22,15 +21,18 @@ class Command(BaseCommand): revente.date + timedelta(days=1)) and \ now >= revente.date + timedelta(minutes=15) and \ not revente.notif_sent: + self.stdout.write(str(now)) revente.mail_shotgun() self.stdout.write("Mail de disponibilité immédiate envoyé") # Check si délai de retrait dépassé elif (now >= revente.date + timedelta(hours=1) and not revente.notif_sent): + self.stdout.write(str(now)) revente.send_notif() self.stdout.write("Mail d'inscription à une revente envoyé") # Check si tirage à faire elif (now >= revente.expiration_time and not revente.tirage_done): + self.stdout.write(str(now)) revente.tirage() self.stdout.write("Tirage effectué, mails envoyés") diff --git a/bda/models.py b/bda/models.py index 1074e58b..085bd548 100644 --- a/bda/models.py +++ b/bda/models.py @@ -269,7 +269,7 @@ class SpectacleRevente(models.Model): for participant in inscrits: mail_body = render_template('mail-revente.txt', { 'user': participant.user, - 'spectacle': self.spectacle, + 'spectacle': self.attribution.spectacle, 'revente': self}) mail_tot = mail.EmailMessage( mail_object, mail_body, @@ -290,7 +290,7 @@ class SpectacleRevente(models.Model): for participant in inscrits: mail_body = render_template('mail-shotgun.txt', { 'user': participant.user, - 'spectacle': self.spectacle, + 'spectacle': self.attribution.spectacle, 'mail': self.attribution.participant.user.email}) mail_tot = mail.EmailMessage( mail_object, mail_body, diff --git a/bda/templates/mail-revente.txt b/bda/templates/mail-revente.txt index adc61eb9..94cab1b1 100644 --- a/bda/templates/mail-revente.txt +++ b/bda/templates/mail-revente.txt @@ -2,7 +2,7 @@ Bonjour {{ user.get_full_name }} Une place pour le spectacle {{ spectacle.title }} ({{spectacle.date_no_seconds}}) a été postée sur BdA-Revente. -Si ce spectacle t'intéresse toujours, merci de nous le signaler en cliquant sur ce lien : {% url "bda-interested-revente" revente.id %}. Dans le cas où plusieurs personnes seraient intéressées, nous procèderons à un tirage au sort le {{revente.date_no_seconds}} +Si ce spectacle t'intéresse toujours, merci de nous le signaler en cliquant sur ce lien : {% url "bda-revente-interested" revente.id %}. Dans le cas où plusieurs personnes seraient intéressées, nous procèderons à un tirage au sort le {{revente.date_no_seconds}} Chaleureusement, Le BdA diff --git a/bda/templates/mail-shotgun.txt b/bda/templates/mail-shotgun.txt index 8c4e7bd9..4f972cf9 100644 --- a/bda/templates/mail-shotgun.txt +++ b/bda/templates/mail-shotgun.txt @@ -2,7 +2,7 @@ Bonjour {{ user.get_full_name }} Une place pour le spectacle {{ spectacle.title }} ({{spectacle.date_no_seconds}}) a été postée sur BdA-Revente. -Puisque ce spectacle a lieu dans moins de 24h, il n'y a pas de tirage au sort pour cette place : elle est disponible immédiatement à l'addresse {{url "bda-buy-revente" spectacle.id}}, à la disposition de tous. +Puisque ce spectacle a lieu dans moins de 24h, il n'y a pas de tirage au sort pour cette place : elle est disponible immédiatement à l'addresse {%url "bda-buy-revente" spectacle.id%}, à la disposition de tous. Chaleureusement, Le BdA