Commits

Matthew Schinckel committed 6c1b05b

Convert logging time to ADMIN_TIME_ZONE

Comments (0)

Files changed (1)

rest_api/middleware.py

 import time
 import sys
 
+from timezones.utils import adjust_datetime_to_timezone
+
 import serializers
 
 class HttpAuthMiddleware(object):
                     request.META.get('REMOTE_ADDR'),
                     '-',
                     '-',
-                    (datetime.datetime.now() + datetime.timedelta(hours=9.5)).strftime("%d/%b/%Y %H:%M:%S"),
+                    adjust_datetime_to_timezone(datetime.datetime.now(), settings.TIME_ZONE, getattr(settings, 'ADMIN_TIME_ZONE', settings.TIME_ZONE)).strftime("%d/%b/%Y %H:%M:%S"),
                     request.method,
                     request.get_full_path(),
                     "HTTP/1.1",