diff --git a/auth/security/__init__.py b/auth/security/__init__.py index 1b3911cf4db0834dbb1cc991cf27607ac3a936d6..28aa6fa4010bb8634eaf6359fc1def51c128de4b 100644 --- a/auth/security/__init__.py +++ b/auth/security/__init__.py @@ -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: diff --git a/helios/models.py b/helios/models.py index c315635924e82793b7be2c2b1446c8d8681b2857..c241cfac84996d0c251dbf0e051a4c4615051ae2 100644 --- a/helios/models.py +++ b/helios/models.py @@ -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): diff --git a/helios/templates/election_view.html b/helios/templates/election_view.html index 65b16a8dbfb5c525d0438bf193f444d292d074b5..7570d494c2165dea028c714e413737c1680db234 100644 --- a/helios/templates/election_view.html +++ b/helios/templates/election_view.html @@ -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. diff --git a/helios/views.py b/helios/views.py index 4760474065afca672010ec22da98921589e8220f..b26b17132d3cabf0ae66c1f556d3764c43eefd2b 100644 --- a/helios/views.py +++ b/helios/views.py @@ -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,