Safely handle invalid book

This commit is contained in:
Mouse Reeve 2021-04-23 15:29:55 -07:00
parent a499259163
commit 179ba24115

View file

@ -171,6 +171,8 @@ def get_next_shelf(current_shelf):
@register.filter(name="title")
def get_title(book):
""" display the subtitle if the title is short """
if not book:
return ""
title = book.title
if len(title) < 6 and book.subtitle:
title = "{:s}: {:s}".format(title, book.subtitle)