Entity: fix name_find when alternativeNames is non-empty

Previously, given:

    name = "foo"
    alternativeNames = ("bar", "baz")

then:

    name_find = '||foobar||baz||'
This commit is contained in:
Will Thompson 2015-05-20 12:16:32 +02:00 committed by j
parent b7a83554ab
commit fe7f961ff6

View file

@ -55,7 +55,7 @@ class Entity(models.Model):
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
self.name_find = '||' + self.name + '||'.join(self.alternativeNames) + '||' self.name_find = '||' + '||'.join((self.name,) + self.alternativeNames) + '||'
super(Entity, self).save(*args, **kwargs) super(Entity, self).save(*args, **kwargs)
self.update_matches() self.update_matches()
self.update_annotations() self.update_annotations()