Ajoute les horaires de vote dans le mail d'annonce

This commit is contained in:
Tom Hubrecht 2022-01-08 02:55:22 +01:00
parent b2c55b824a
commit f9271f5690
2 changed files with 5 additions and 0 deletions

View file

@ -5,6 +5,7 @@ MAIL_VOTERS = (
"\n" "\n"
"\n" "\n"
"Election URL: {election_url}\n" "Election URL: {election_url}\n"
"The election will take place from {start} to {end}.\n"
"\n" "\n"
"Your voter ID: {username}\n" "Your voter ID: {username}\n"
"Your password: {password}\n" "Your password: {password}\n"

View file

@ -405,6 +405,8 @@ def send_mail(election, subject, body, reply_to):
voters = list(election.registered_voters.exclude(has_valid_email=True)) voters = list(election.registered_voters.exclude(has_valid_email=True))
e_url = reverse("election.view", args=[election.id]) e_url = reverse("election.view", args=[election.id])
url = f"https://vote.eleves.ens.fr{e_url}" 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 = [] messages = []
for v in voters: for v in voters:
password = generate_password() password = generate_password()
@ -416,6 +418,8 @@ def send_mail(election, subject, body, reply_to):
body=body.format( body=body.format(
full_name=v.full_name, full_name=v.full_name,
election_url=url, election_url=url,
start=start,
end=end,
username=v.base_username, username=v.base_username,
password=password, password=password,
), ),