forked from 0x2620/pandora
fix finding alternative titles fixes #2123
This commit is contained in:
parent
aed67ea8f1
commit
c5aefa2f00
1 changed files with 14 additions and 8 deletions
|
@ -697,17 +697,21 @@ class Item(models.Model):
|
||||||
else:
|
else:
|
||||||
ItemFind.objects.filter(item=self, key=key).delete()
|
ItemFind.objects.filter(item=self, key=key).delete()
|
||||||
|
|
||||||
|
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]
|
||||||
|
return titles
|
||||||
|
|
||||||
|
|
||||||
with transaction.commit_on_success():
|
with transaction.commit_on_success():
|
||||||
for key in settings.CONFIG['itemKeys']:
|
for key in settings.CONFIG['itemKeys']:
|
||||||
i = key['id']
|
i = key['id']
|
||||||
if i == 'title':
|
if i == 'title':
|
||||||
titles = [self.get('title', 'Untitled')]
|
save(i, u'\n'.join(get_titles()))
|
||||||
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))
|
|
||||||
elif i == 'rightslevel':
|
elif i == 'rightslevel':
|
||||||
save(i, self.level)
|
save(i, self.level)
|
||||||
elif i == 'filename':
|
elif i == 'filename':
|
||||||
|
@ -729,7 +733,9 @@ class Item(models.Model):
|
||||||
save(i, value)
|
save(i, value)
|
||||||
|
|
||||||
for key in self.facet_keys:
|
for key in self.facet_keys:
|
||||||
if key == 'character':
|
if i == 'title':
|
||||||
|
values = get_titles()
|
||||||
|
elif key == 'character':
|
||||||
values = self.get('cast', '')
|
values = self.get('cast', '')
|
||||||
if values:
|
if values:
|
||||||
values = filter(lambda x: x.strip(),
|
values = filter(lambda x: x.strip(),
|
||||||
|
|
Loading…
Reference in a new issue