From f9271f5690c947c0ba8a008d05030d708e37a942 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Sat, 8 Jan 2022 02:55:22 +0100 Subject: [PATCH] Ajoute les horaires de vote dans le mail d'annonce --- elections/staticdefs.py | 1 + elections/utils.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/elections/staticdefs.py b/elections/staticdefs.py index d2389af..4f9d27a 100644 --- a/elections/staticdefs.py +++ b/elections/staticdefs.py @@ -5,6 +5,7 @@ MAIL_VOTERS = ( "\n" "\n" "Election URL: {election_url}\n" + "The election will take place from {start} to {end}.\n" "\n" "Your voter ID: {username}\n" "Your password: {password}\n" diff --git a/elections/utils.py b/elections/utils.py index d85f2e7..af33669 100644 --- a/elections/utils.py +++ b/elections/utils.py @@ -405,6 +405,8 @@ def send_mail(election, subject, body, reply_to): voters = list(election.registered_voters.exclude(has_valid_email=True)) e_url = reverse("election.view", args=[election.id]) url = f"https://vote.eleves.ens.fr{e_url}" + start = election.start_date.strftime("%d/%m/%Y %H:%M %Z") + end = election.end_date.strftime("%d/%m/%Y %H:%M %Z") messages = [] for v in voters: password = generate_password() @@ -416,6 +418,8 @@ def send_mail(election, subject, body, reply_to): body=body.format( full_name=v.full_name, election_url=url, + start=start, + end=end, username=v.base_username, password=password, ),