name must be unicode
This commit is contained in:
parent
c1e49e416f
commit
83393ee385
1 changed files with 2 additions and 0 deletions
|
@ -46,6 +46,8 @@ class Entity(models.Model):
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
entity = get_by_id(settings.CONFIG['entities'], self.type)
|
entity = get_by_id(settings.CONFIG['entities'], self.type)
|
||||||
if entity.get('sortType') == 'person' and self.name:
|
if entity.get('sortType') == 'person' and self.name:
|
||||||
|
if isinstance(self.name, str):
|
||||||
|
self.name = self.name.decode('utf-8')
|
||||||
self.name_sort = get_name_sort(self.name)[:255].lower()
|
self.name_sort = get_name_sort(self.name)[:255].lower()
|
||||||
else:
|
else:
|
||||||
self.name_sort = ox.sort_string(self.name or u'')[:255].lower() or None
|
self.name_sort = ox.sort_string(self.name or u'')[:255].lower() or None
|
||||||
|
|
Loading…
Reference in a new issue