city values are unicode in django 1.4

This commit is contained in:
j 2012-06-04 21:22:44 +02:00
parent d6dbf4c344
commit a0d337e6d8

View file

@ -65,7 +65,9 @@ class SessionData(models.Model):
if location:
country = ox.get_country_name(location['country_code'])
if location['city']:
city = location['city'].decode('latin-1')
city = location['city']
if type(city) != unicode:
city = city.decode('latin-1')
self.location = u'%s, %s' % (city, country)
self.location_sort = u'%s, %s' % (country, city)
else: