Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
2020
PPL-C
PPTI-Mobile Apps Monitoring Wabah Tuberkolosis
Neza-Backend
Commits
0373138d
Commit
0373138d
authored
May 28, 2020
by
Dave Nathanael
Browse files
[GREEN] Change cases CSV file name to have current datetime
parent
2f7efa2a
Pipeline
#48018
passed with stages
in 14 minutes and 14 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/exportables/views.py
View file @
0373138d
from
django.http
import
JsonResponse
from
django.db.models
import
Max
from
django.utils
import
timezone
from
rest_framework
import
status
,
serializers
from
rest_framework.response
import
Response
from
rest_framework.views
import
APIView
...
...
@@ -128,6 +129,7 @@ class ExportInvestigationCaseView(APIView):
"reference_case"
,
"author"
).
values
(
*
INVESTIGATION_CASE_RENDERER_FIELDS
))
headers
=
{
"Content-Disposition"
:
'attachment; filename="cases.csv"'
}
filename
=
"cases-{}.csv"
.
format
(
timezone
.
localtime
(
timezone
.
now
()))
headers
=
{
"Content-Disposition"
:
'attachment; filename="{}"'
.
format
(
filename
)}
return
Response
(
data
,
headers
=
headers
)
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment