Skip to content

Commit

Permalink
efficiency fixes, UTC indication
Browse files Browse the repository at this point in the history
  • Loading branch information
benadida committed Oct 12, 2010
1 parent 8a30131 commit 383f010
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion auth/security/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def admin_required_wrapper(request, *args, **kw):
# 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:
Expand Down
4 changes: 2 additions & 2 deletions helios/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def get_by_user_as_voter(cls, user):
@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

Expand Down Expand Up @@ -599,7 +599,7 @@ def get_by_election_and_uuid(cls, election, uuid):

@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):
Expand Down
6 changes: 3 additions & 3 deletions helios/templates/election_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ <h2 class="highlight-box">Tally</h2>
{% 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.
Expand Down
4 changes: 2 additions & 2 deletions helios/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,10 +898,10 @@ 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,
Expand Down

0 comments on commit 383f010

Please sign in to comment.