Skip to content

Commit c8dcee9

Browse files
committed
Improved the timezone middleware example slightly.
This change avoids having the timezone leak from a request to the next.
1 parent 84d8b24 commit c8dcee9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/topics/i18n/timezones.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ Add the following middleware to :setting:`MIDDLEWARE_CLASSES`::
189189
tz = request.session.get('django_timezone')
190190
if tz:
191191
timezone.activate(tz)
192+
else:
193+
timezone.deactivate()
192194

193195
Create a view that can set the current timezone::
194196

0 commit comments

Comments
 (0)