aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2023-05-31 18:38:27 -0400
committerBobby <[email protected]>2023-05-31 18:38:27 -0400
commit7689596bf4582d95640386f7495d1786c67678d4 (patch)
tree6993a6f0b74ca41bb781c651c174d8602ca641d1
parent5ee61807ac868a948625b6d3d904cfde99179e15 (diff)
downloadthatcomputerscientist-7689596bf4582d95640386f7495d1786c67678d4.tar.xz
thatcomputerscientist-7689596bf4582d95640386f7495d1786c67678d4.zip
Fix: Geodata not found
-rw-r--r--middleware/tz.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/middleware/tz.py b/middleware/tz.py
index 4aa3087a..35565834 100644
--- a/middleware/tz.py
+++ b/middleware/tz.py
@@ -23,7 +23,7 @@ class TimezoneMiddleware(object):
remote_ip = request.META.get('REMOTE_ADDR')
geo_data = requests.get(f'http://ip-api.com/json/{remote_ip}').json()
- user_timezone = geo_data['timezone']
+ user_timezone = geo_data['timezone'] or 'UTC'
if user_timezone:
response = self.get_response(request)