forked from 0x2620/pandora
ips without city
This commit is contained in:
parent
105e91d6dd
commit
9b02269361
1 changed files with 6 additions and 3 deletions
|
@ -61,10 +61,13 @@ class SessionData(models.Model):
|
||||||
g = GeoIP()
|
g = GeoIP()
|
||||||
location = g.city(self.ip)
|
location = g.city(self.ip)
|
||||||
if location:
|
if location:
|
||||||
city = location['city'].decode('latin-1')
|
|
||||||
country = ox.get_country_name(location['country_code'])
|
country = ox.get_country_name(location['country_code'])
|
||||||
|
if location['city']:
|
||||||
|
city = location['city'].decode('latin-1')
|
||||||
self.location = u'%s, %s' % (city, country)
|
self.location = u'%s, %s' % (city, country)
|
||||||
self.location_sort = u'%s, %s' % (country, city)
|
self.location_sort = u'%s, %s' % (country, city)
|
||||||
|
else:
|
||||||
|
self.location_sort = self.location = country
|
||||||
else:
|
else:
|
||||||
self.location_sort = self.location = None
|
self.location_sort = self.location = None
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in a new issue