Safely handle invalid book
This commit is contained in:
parent
a499259163
commit
179ba24115
@ -171,6 +171,8 @@ def get_next_shelf(current_shelf):
|
|||||||
@register.filter(name="title")
|
@register.filter(name="title")
|
||||||
def get_title(book):
|
def get_title(book):
|
||||||
""" display the subtitle if the title is short """
|
""" display the subtitle if the title is short """
|
||||||
|
if not book:
|
||||||
|
return ""
|
||||||
title = book.title
|
title = book.title
|
||||||
if len(title) < 6 and book.subtitle:
|
if len(title) < 6 and book.subtitle:
|
||||||
title = "{:s}: {:s}".format(title, book.subtitle)
|
title = "{:s}: {:s}".format(title, book.subtitle)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user