fix finding alternative titles fixes #2123

This commit is contained in:
j 2014-01-27 12:46:18 +00:00
parent aed67ea8f1
commit c5aefa2f00

View file

@ -697,17 +697,21 @@ class Item(models.Model):
else:
ItemFind.objects.filter(item=self, key=key).delete()
with transaction.commit_on_success():
for key in settings.CONFIG['itemKeys']:
i = key['id']
if i == 'title':
def get_titles():
titles = [self.get('title', 'Untitled')]
if self.get('originalTitle'):
titles.append(self.get('originalTitle'))
at = self.get('alternativeTitles')
if at:
titles += [a[0] for a in at]
save(i, u'\n'.join(titles))
return titles
with transaction.commit_on_success():
for key in settings.CONFIG['itemKeys']:
i = key['id']
if i == 'title':
save(i, u'\n'.join(get_titles()))
elif i == 'rightslevel':
save(i, self.level)
elif i == 'filename':
@ -729,7 +733,9 @@ class Item(models.Model):
save(i, value)
for key in self.facet_keys:
if key == 'character':
if i == 'title':
values = get_titles()
elif key == 'character':
values = self.get('cast', '')
if values:
values = filter(lambda x: x.strip(),