mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 12:01:14 +00:00
Safer display of book descriptions
This commit is contained in:
parent
c8fc907705
commit
0cf9e1033b
1 changed files with 6 additions and 1 deletions
|
@ -8,7 +8,12 @@ register = template.Library()
|
|||
@register.filter(name="book_description")
|
||||
def get_book_description(book):
|
||||
"""use the work's text if the book doesn't have it"""
|
||||
return book.description or book.parent_work.description
|
||||
if book.description:
|
||||
return book.description
|
||||
if book.parent_work:
|
||||
# this shoud always be true
|
||||
return book.parent_work.description
|
||||
return None
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=False)
|
||||
|
|
Loading…
Reference in a new issue