ccdb-api/ccdb/users/middleware.py
Matthew Dillon 7ba937ef66 INITIAL
2016-01-19 15:10:09 -07:00

13 lines
346 B
Python

import pytz
from django.utils import timezone
class TimezoneMiddleware(object):
def process_request(self, request):
if not request.user.is_anonymous():
tzname = request.user.timezone
if tzname:
timezone.activate(pytz.timezone(tzname))
else:
timezone.deactivate()