sort name

This commit is contained in:
j 2011-10-30 02:50:38 +02:00
parent 90f735acb5
commit f164e38886
2 changed files with 3 additions and 2 deletions

View file

@ -742,7 +742,7 @@ class Item(models.Model):
for value in current_values:
if value not in saved_values:
sortvalue = value
if key in self.person_keys:
if key in self.person_keys + ['name']:
sortvalue = get_name_sort(value)
Facet.objects.get_or_create(item=self, key=key, value=value, sortvalue=sortvalue)

View file

@ -48,11 +48,12 @@ class Person(models.Model):
if not self.sortname:
self.sortname = ox.get_sort_name(self.name)
self.sortname = unicodedata.normalize('NFKD', self.sortname)
self.sortname = self.sortname.replace(u'Æ', 'AE').replace(u'Ø', 'O').replace(u'Þ', 'P')
self.sortsortname = utils.sort_string(self.sortname)
self.numberofnames = len(self.name.split(' '))
super(Person, self).save(*args, **kwargs)
item.models.Facet.objects.filter(
key__in=item.models.Item.person_keys,
key__in=item.models.Item.person_keys + ['name'],
value=self.name
).exclude(
sortvalue=self.sortname