Handle items with no label

This commit is contained in:
Edward Betts 2021-07-06 17:24:57 +02:00
parent f60aa70472
commit 0658976246
1 changed files with 3 additions and 1 deletions

View File

@ -54,7 +54,9 @@ class Item(Base):
return self.labels[lang]['value']
elif 'en' in self.labels:
return self.labels['en']['value']
return list(self.labels.values())[0]['value']
label_list = list(self.labels.values())
return label_list[0]['value'] if label_list else '[no label]'
def description(self, lang='en'):
if lang in self.descriptions: