Fix linting issues

This commit is contained in:
Christopher C. Wells 2021-10-17 14:45:53 -07:00 committed by Christopher Charbonneau Wells
parent 0efe0e4f0b
commit b5d9875e9a
1 changed files with 3 additions and 2 deletions

View File

@ -17,9 +17,10 @@ class UserTimezoneMiddleware:
self.get_response = get_response
def __call__(self, request):
if hasattr(request.user, 'settings') and request.user.settings.timezone:
user = request.user
if hasattr(user, 'settings') and user.settings.timezone:
try:
timezone.activate(pytz.timezone(request.user.settings.timezone))
timezone.activate(pytz.timezone(user.settings.timezone))
except pytz.UnknownTimeZoneError:
pass
return self.get_response(request)