From 18bd068ef1d754f7ebd394954ccb68cd9bcbad89 Mon Sep 17 00:00:00 2001 From: Mateusz Kowalski Date: Wed, 1 Feb 2017 10:05:29 +0100 Subject: [PATCH] Fix ignored timezone value from local_settings When django_timezone not set in session or cookie, default value is taken from the settings file but in there has to be looked as TIME_ZONE Change-Id: Idf93084f654ab65a2ed0dba7bc583147210cf175 Closes-bug: #1660648 --- horizon/utils/functions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/horizon/utils/functions.py b/horizon/utils/functions.py index 8b93fb95e1..962756b5a4 100644 --- a/horizon/utils/functions.py +++ b/horizon/utils/functions.py @@ -107,7 +107,11 @@ def get_log_length(request): def get_timezone(request): - return get_config_value(request, 'django_timezone', 'UTC') + # Session and cookie store timezone as django_timezone. + # In case there is no timezone neither in session nor cookie + # use default value from settings file where it's called TIME_ZONE + return get_config_value(request, 'django_timezone', + getattr(settings, 'TIME_ZONE', 'UTC')) def get_language(request):