Skip to content
Snippets Groups Projects
Commit c4787318 authored by Ben Adida's avatar Ben Adida Committed by GitHub
Browse files

allow viewing a vote by full hash so we don't do quite as many DB queries.

parent 1da79be3
No related branches found
No related tags found
No related merge requests found
......@@ -143,7 +143,7 @@ Voters {{voters_page.start_index}} - {{voters_page.end_index}} (of {{total_voter
{% if election.use_voter_aliases %}
<td>{{voter.alias}}</td>
{% endif %}
<td><tt style="font-size: 1.4em;">{% if voter.vote_hash %}{{voter.vote_hash}} <span style="font-size:0.8em;">[<a href="{% url "shortcut@vote" vote_tinyhash=voter.vote_tinyhash %}">view</a>]</span>{% else %}&mdash;{% endif %}</tt></td>
<td><tt style="font-size: 1.4em;">{% if voter.vote_hash %}{{voter.vote_hash}} <span style="font-size:0.8em;">[<a href="{% url "shortcut-fullhash@vote" vote_hash=voter.vote_hash %}">view</a>]</span>{% else %}&mdash;{% endif %}</tt></td>
</tr>
{% endfor %}
</table>
......
......@@ -3,7 +3,7 @@ from helios import election_url_names as election, stats_url_names as stats
__all__ = [
"election", "stats",
"COOKIE_TEST", "COOKIE_TEST_2", "COOKIE_NO",
"ELECTION_SHORTCUT", "ELECTION_SHORTCUT_VOTE", "CAST_VOTE_SHORTCUT",
"ELECTION_SHORTCUT", "ELECTION_SHORTCUT_VOTE", "CAST_VOTE_SHORTCUT", "CAST_VOTE_FULLHASH_SHORTCUT",
"TRUSTEE_LOGIN",
"ELECTIONS_PARAMS", "ELECTIONS_VERIFIER", "ELECTIONS_VERIFIER_SINGLE_BALLOT",
"ELECTIONS_NEW", "ELECTIONS_ADMINISTERED", "ELECTIONS_VOTED",
......@@ -16,6 +16,7 @@ COOKIE_NO="cookie@no"
ELECTION_SHORTCUT="shortcut@election"
ELECTION_SHORTCUT_VOTE="shortcut@election@vote"
CAST_VOTE_SHORTCUT="shortcut@vote"
CAST_VOTE_FULLHASH_SHORTCUT="shortcut-fullhash@vote"
TRUSTEE_LOGIN="trustee@login"
......
......@@ -16,6 +16,9 @@ urlpatterns = [
# vote shortcut
url(r'^v/(?P<vote_tinyhash>[^/]+)$', views.castvote_shortcut, name=names.CAST_VOTE_SHORTCUT),
# vote by hash
url(r'^vh/(?P<vote_hash>[^/]+)$', views.castvote_fullhash_shortcut, name=names.CAST_VOTE_FULLHASH_SHORTCUT),
# trustee login
url(r'^t/(?P<election_short_name>[^/]+)/(?P<trustee_email>[^/]+)/(?P<trustee_secret>[^/]+)$', views.trustee_login,
......
......@@ -147,6 +147,14 @@ def castvote_shortcut(request, vote_tinyhash):
return _castvote_shortcut_by_election(request, election_uuid = cast_vote.voter.election.uuid, cast_vote=cast_vote)
def castvote_fullhash_shortcut(request, vote_hash):
try:
cast_vote = CastVote.objects.get(vote_hash = vote_hash)
except CastVote.DoesNotExist:
raise Http404
return _castvote_shortcut_by_election(request, election_uuid = cast_vote.voter.election.uuid, cast_vote=cast_vote)
@trustee_check
def trustee_keygenerator(request, election, trustee):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment