diff --git a/api/views.py b/api/views.py index a676bca5cdee67973566313c9a145cfec5f795a3..e6fc9f7727f55a71a9efb0a7b091a712d688bff1 100644 --- a/api/views.py +++ b/api/views.py @@ -1,3 +1,4 @@ +import pytz from django.http import JsonResponse from django.views.generic import TemplateView, View @@ -21,6 +22,16 @@ class IndexView(TemplateView): def election_as_dict(election): + voting_start_at = ( + election.voting_start_at.replace(tzinfo=pytz.UTC) + if election.voting_start_at + else None + ) + voting_end_at = ( + election.voting_end_at.replace(tzinfo=pytz.UTC) + if election.voting_end_at + else None + ) return { "name": election.name, "uuid": election.uuid, @@ -29,8 +40,8 @@ def election_as_dict(election): "created_at": election.created_at, "voting_has_started": election.voting_has_started(), "voting_has_stopped": election.voting_has_stopped(), - "voting_start_at": election.voting_start_at, - "voting_end_at": election.voting_end_at, + "voting_start_at": voting_start_at, + "voting_end_at": voting_end_at, } diff --git a/manage.py b/manage.py old mode 100644 new mode 100755