Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Helios Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Helios Server
Commits
66ecf7cd
Commit
66ecf7cd
authored
1 year ago
by
jan.bednarik
Browse files
Options
Downloads
Patches
Plain Diff
Timezones in API
parent
7535ed6c
No related branches found
No related tags found
1 merge request
!33
Timezones in API
Pipeline
#16924
passed
1 year ago
Stage: build
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/views.py
+13
-2
13 additions, 2 deletions
api/views.py
manage.py
+0
-0
0 additions, 0 deletions
manage.py
with
13 additions
and
2 deletions
api/views.py
+
13
−
2
View file @
66ecf7cd
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
,
}
...
...
This diff is collapsed.
Click to expand it.
manage.py
100644 → 100755
+
0
−
0
View file @
66ecf7cd
File mode changed from 100644 to 100755
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment