entity sort name
This commit is contained in:
parent
d5ae7245c2
commit
34506d5b99
2 changed files with 5 additions and 2 deletions
|
@ -48,7 +48,7 @@ class Entity(models.Model):
|
|||
if entity.get('sortType') == 'person' and self.name:
|
||||
self.name_sort = get_name_sort(self.name)[:255].lower()
|
||||
else:
|
||||
self.name_sort = ox.sort_string(self.name or u'')[:255].lower()
|
||||
self.name_sort = ox.sort_string(self.name or u'')[:255].lower() or None
|
||||
self.name_find = '||' + self.name + '||'.join(self.alternativeNames) + '||'
|
||||
super(Entity, self).save(*args, **kwargs)
|
||||
self.update_matches()
|
||||
|
@ -123,6 +123,7 @@ class Entity(models.Model):
|
|||
'editable',
|
||||
'id',
|
||||
'name',
|
||||
'sortName',
|
||||
'type',
|
||||
'user',
|
||||
] + self.data.keys()
|
||||
|
@ -136,6 +137,8 @@ class Entity(models.Model):
|
|||
response[key] = self.user and self.user.username
|
||||
elif key in ('name', 'alternativeNames', 'type'):
|
||||
response[key] = getattr(self, key)
|
||||
elif key == 'sortName':
|
||||
response[key] = self.name_sort
|
||||
elif key in self.data:
|
||||
response[key] = self.data[key]
|
||||
return response
|
||||
|
|
|
@ -184,7 +184,7 @@ def _order_query(qs, sort, item=None):
|
|||
def parse_query(data, user):
|
||||
query = {}
|
||||
query['range'] = [0, 100]
|
||||
query['sort'] = [{'key':'name', 'operator':'+'}, {'key':'type', 'operator':'+'}]
|
||||
query['sort'] = [{'key':'name', 'operator':'+'}]
|
||||
for key in ('keys', 'group', 'range', 'position', 'positions', 'sort'):
|
||||
if key in data:
|
||||
query[key] = data[key]
|
||||
|
|
Loading…
Reference in a new issue