Explorar o código

changes for the view

VISHAL BHANUSHALI hai 4 semanas
pai
achega
f443d753f3
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      title_creator_app/views.py

+ 4 - 2
title_creator_app/views.py

@@ -22,6 +22,7 @@ from rest_framework import status
 from rest_framework.views import APIView
 from django.utils import timezone
 import logging
+from zoneinfo import ZoneInfo
 logger = logging.getLogger(__name__)
 
 # To login
@@ -622,11 +623,12 @@ def get_title_creator_tasks_json(request):
             'filename': t.original_filename or "Unknown File",
             'status': t.status,
             'url': t.download_url,
-            'date': t.created_at.strftime("%d %b %Y, %I:%M %p"),
+            'date': t.created_at.astimezone(ZoneInfo("Asia/Kolkata")).strftime("%d %b %Y, %I:%M %p"),
             # Use a conditional (ternary) operator to handle the null case
-            'completed_at': t.completed_at.strftime("%d %b %Y, %I:%M %p") if t.completed_at else ""
+            'completed_at': t.completed_at.astimezone(ZoneInfo("Asia/Kolkata")).strftime("%d %b %Y, %I:%M %p") if t.completed_at else ""
             # 'completed_at': t.completed_at.strftime("%d %b %Y, %I:%M %p")
         })
+        print("data",data)
     return JsonResponse(data, safe=False)