Improved the timezone middleware example slightly.

This change avoids having the timezone leak from a request to the next.
This commit is contained in:
Aymeric Augustin 2013-05-15 16:43:39 +02:00
parent 84d8b247d2
commit c8dcee9a42
1 changed files with 2 additions and 0 deletions

View File

@ -189,6 +189,8 @@ Add the following middleware to :setting:`MIDDLEWARE_CLASSES`::
tz = request.session.get('django_timezone')
if tz:
timezone.activate(tz)
else:
timezone.deactivate()
Create a view that can set the current timezone::