mirror of https://github.com/snachodog/mybuddy.git
Remove deprecated `TIME_ZONE` environment variable configuration
Closes #301
This commit is contained in:
parent
34fe811a54
commit
f155caa268
|
@ -104,10 +104,9 @@ class UserLanguageMiddleware:
|
||||||
|
|
||||||
class UserTimezoneMiddleware:
|
class UserTimezoneMiddleware:
|
||||||
"""
|
"""
|
||||||
Sets the timezone based on a user specific setting that falls back on
|
Sets the timezone based on a user specific setting. This middleware must run after
|
||||||
`settings.TIME_ZONE`. This middleware must run after
|
`django.contrib.auth.middleware.AuthenticationMiddleware` because it uses the
|
||||||
`django.contrib.auth.middleware.AuthenticationMiddleware` because it uses
|
request.user object.
|
||||||
the request.user object.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, get_response):
|
def __init__(self, get_response):
|
||||||
|
|
|
@ -158,7 +158,7 @@ if REVERSE_PROXY_AUTH:
|
||||||
|
|
||||||
USE_TZ = True
|
USE_TZ = True
|
||||||
|
|
||||||
TIME_ZONE = os.environ.get("TIME_ZONE") or "UTC"
|
TIME_ZONE = "UTC"
|
||||||
|
|
||||||
# Internationalization
|
# Internationalization
|
||||||
# https://docs.djangoproject.com/en/4.0/topics/i18n/
|
# https://docs.djangoproject.com/en/4.0/topics/i18n/
|
||||||
|
|
|
@ -222,11 +222,10 @@ class FormsTestCase(TestCase):
|
||||||
page = self.c.post("/user/settings/", data=params, follow=True)
|
page = self.c.post("/user/settings/", data=params, follow=True)
|
||||||
self.assertContains(page, "Paramètres utilisateur")
|
self.assertContains(page, "Paramètres utilisateur")
|
||||||
|
|
||||||
@override_settings(TIME_ZONE="US/Eastern")
|
|
||||||
def test_user_settings_timezone(self):
|
def test_user_settings_timezone(self):
|
||||||
self.c.login(**self.credentials)
|
self.c.login(**self.credentials)
|
||||||
|
|
||||||
self.assertEqual(timezone.get_default_timezone_name(), "US/Eastern")
|
self.assertEqual(timezone.get_default_timezone_name(), "UTC")
|
||||||
params = self.settings_template.copy()
|
params = self.settings_template.copy()
|
||||||
params["timezone"] = "US/Pacific"
|
params["timezone"] = "US/Pacific"
|
||||||
page = self.c.post("/user/settings/", data=params, follow=True)
|
page = self.c.post("/user/settings/", data=params, follow=True)
|
||||||
|
|
Loading…
Reference in New Issue