mirror of https://github.com/django/django.git
Fixed #28112 -- Added 'time_zone' in GeoIP2.city() dict.
This commit is contained in:
parent
01f658644a
commit
502f03d897
|
@ -8,6 +8,7 @@ def City(response):
|
||||||
'longitude': response.location.longitude,
|
'longitude': response.location.longitude,
|
||||||
'postal_code': response.postal.code,
|
'postal_code': response.postal.code,
|
||||||
'region': response.subdivisions[0].iso_code if len(response.subdivisions) else None,
|
'region': response.subdivisions[0].iso_code if len(response.subdivisions) else None,
|
||||||
|
'time_zone': response.location.time_zone,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,8 @@ Here is an example of its usage::
|
||||||
'latitude': 37.419200897216797,
|
'latitude': 37.419200897216797,
|
||||||
'longitude': -122.05740356445312,
|
'longitude': -122.05740356445312,
|
||||||
'postal_code': '94043',
|
'postal_code': '94043',
|
||||||
'region': 'CA'}
|
'region': 'CA',
|
||||||
|
'time_zone': 'America/Los_Angeles'}
|
||||||
>>> g.lat_lon('salon.com')
|
>>> g.lat_lon('salon.com')
|
||||||
(39.0437, -77.4875)
|
(39.0437, -77.4875)
|
||||||
>>> g.lon_lat('uh.edu')
|
>>> g.lon_lat('uh.edu')
|
||||||
|
|
|
@ -118,6 +118,7 @@ class GeoIPTest(unittest.TestCase):
|
||||||
self.assertEqual('US', d['country_code'])
|
self.assertEqual('US', d['country_code'])
|
||||||
self.assertEqual('Houston', d['city'])
|
self.assertEqual('Houston', d['city'])
|
||||||
self.assertEqual('TX', d['region'])
|
self.assertEqual('TX', d['region'])
|
||||||
|
self.assertEqual('America/Chicago', d['time_zone'])
|
||||||
|
|
||||||
geom = g.geos(query)
|
geom = g.geos(query)
|
||||||
self.assertIsInstance(geom, GEOSGeometry)
|
self.assertIsInstance(geom, GEOSGeometry)
|
||||||
|
|
Loading…
Reference in New Issue