Skip to content
Snippets Groups Projects
Commit 383f0102 authored by Ben Adida's avatar Ben Adida
Browse files

efficiency fixes, UTC indication

parent 8a301316
No related branches found
No related tags found
No related merge requests found
......@@ -92,7 +92,7 @@ def admin_required(func):
# get the user
def get_user(request):
# push the expiration of the session back
request.session.set_expiry(settings.SESSION_COOKIE_AGE)
# request.session.set_expiry(settings.SESSION_COOKIE_AGE)
# set up CSRF protection if needed
if not request.session.has_key('csrf_token') or type(request.session['csrf_token']) != str:
......
......@@ -152,7 +152,7 @@ class Election(models.Model, electionalgs.Election):
@classmethod
def get_by_uuid(cls, uuid):
try:
return cls.objects.get(uuid=uuid)
return cls.objects.select_related().get(uuid=uuid)
except cls.DoesNotExist:
return None
......@@ -599,7 +599,7 @@ class Voter(models.Model, electionalgs.Voter):
@classmethod
def get_by_user(cls, user):
return cls.objects.filter(voter_type = user.user_type, voter_id = user.user_id).order_by('-cast_at')
return cls.objects.select_related().filter(voter_type = user.user_type, voter_id = user.user_id).order_by('-cast_at')
@property
def user(self):
......
......@@ -165,12 +165,12 @@ For your privacy, you'll be asked to log in only once your ballot is encrypted.
{% endif %}
{% if election.voting_extended_until %}
<br />
This election was initially scheduled to end at {{election.voting_ends_at}},<br />
but has been extended until {{ election.voting_extended_until }}.
This election was initially scheduled to end at {{election.voting_ends_at}} (UTC),<br />
but has been extended until {{ election.voting_extended_until }} (UTC).
{% else %}
{% if election.voting_ends_at %}
<br />
This election is scheduled to end at {{election.voting_ends_at}}.
This election is scheduled to end at {{election.voting_ends_at}} (UTC).
{% else %}
<br />
This election ends at the administrator's discretion.
......
......@@ -898,11 +898,11 @@ def voters_list_pretty(request, election):
else:
voters = voters.filter(name__icontains = q)
total_voters = voters.count()
voter_paginator = Paginator(voters, limit)
voters_page = voter_paginator.page(page)
total_voters = voter_paginator.count
return render_template(request, 'voters_list', {'election': election, 'voters_page': voters_page,
'voters': voters_page.object_list, 'admin_p': admin_p,
'email_voters': helios.VOTERS_EMAIL,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment