Skip to content
Snippets Groups Projects
Commit d25f9dd5 authored by Edmar Martineli's avatar Edmar Martineli
Browse files

Show election help email address to election administrator, start and

end voting date to election administrator and voters.
parent 1a1df57e
No related branches found
No related tags found
No related merge requests found
......@@ -335,6 +335,22 @@ class Election(HeliosModel):
return return_val
@property
def voting_start_at(self):
voting_start_at = self.voting_starts_at
if voting_start_at and self.frozen_at:
voting_start_at = max(voting_start_at, self.frozen_at)
return voting_start_at
@property
def voting_end_at(self):
voting_end_at = self.voting_ends_at
if voting_end_at and self.voting_extended_until:
voting_end_at = max(voting_end_at, self.voting_extended_until)
if voting_end_at and self.voting_ended_at:
voting_end_at = min(voting_end_at, self.voting_ended_at)
return voting_end_at
def voting_has_started(self):
"""
has voting begun? voting begins if the election is frozen, at the prescribed date or at the date that voting was forced to start
......
......@@ -5,7 +5,12 @@
<h2 class="title">Election {{election.name}} Not Yet Open</h2>
<p>
This election is not yet open. You probably got here from the Ballot Preview.
This election is not yet open.
</p>
<p>
{% if election.voting_start_at %}Voting start at {{election.voting_start_at}}<br />{% endif %}
{% if election.voting_end_at %}Voting end at {{election.voting_end_at}}<br />{% endif %}
</p>
<p>
......
......@@ -8,6 +8,11 @@
This election has already been tallied, you can no longer cast a vote.
</p>
<p>
{% if election.voting_start_at %}Voting start at {{election.voting_start_at}}<br />{% endif %}
{% if election.voting_end_at %}Voting end at {{election.voting_end_at}}<br />{% endif %}
</p>
<p>
<a href="{% url "helios.views.one_election_view" election.uuid %}">view the election tally</a>
</p>
......
......@@ -46,6 +46,12 @@ this {{election.election_type}} is <u>not</u> featured on the front page.
{{election.description_bleached|safe}}
</div>
<p>
{% if election.help_email and admin_p%}Help Email Address: {{election.help_email}}<br />{% endif %}
{% if election.voting_start_at %}Voting start at {{election.voting_start_at}}<br />{% endif %}
{% if election.voting_end_at %}Voting end at {{election.voting_end_at}}<br />{% endif %}
</p>
{% if election.election_info_url %}
<p style="font-size:1.5em;">[<a target="_blank" href="{{election.election_info_url}}" rel="noopener noreferrer">download candidate bios &amp; statements</a>]</p>
{% endif %}
......
......@@ -132,6 +132,10 @@ def _election_vote_shortcut(request, election):
def election_vote_shortcut(request, election_short_name):
election = Election.get_by_short_name(election_short_name)
if election:
if not election.voting_has_started():
return render_template(request, 'election_not_started', {'election': election})
if election.voting_has_stopped():
return render_template(request, 'election_tallied', {'election': election})
return _election_vote_shortcut(request, election_uuid=election.uuid)
else:
raise Http404
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment