mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-25 01:20:35 +00:00
Merge pull request #2263 from bookwyrm-social/safer-book-description
Safer display of book descriptions
This commit is contained in:
commit
d58282bc37
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