Fakultas Ilmu Komputer UI

Commit 0373138d authored by Dave Nathanael's avatar 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
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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment