mirror of
https://github.com/django/django.git
synced 2025-03-31 19:46:42 +00:00
Improved the timezone middleware example slightly.
This change avoids having the timezone leak from a request to the next.
This commit is contained in:
parent
84d8b247d2
commit
c8dcee9a42
@ -189,6 +189,8 @@ Add the following middleware to :setting:`MIDDLEWARE_CLASSES`::
|
|||||||
tz = request.session.get('django_timezone')
|
tz = request.session.get('django_timezone')
|
||||||
if tz:
|
if tz:
|
||||||
timezone.activate(tz)
|
timezone.activate(tz)
|
||||||
|
else:
|
||||||
|
timezone.deactivate()
|
||||||
|
|
||||||
Create a view that can set the current timezone::
|
Create a view that can set the current timezone::
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user