moviewyrm/bookwyrm/templatetags/book_display_tags.py

18 lines
442 B
Python
Raw Normal View History

2022-01-18 20:28:59 +00:00
""" template filters """
from django import template
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
@register.simple_tag(takes_context=False)
def get_book_file_links(book):
"""links for a book"""
return book.file_links.filter(domain__status="approved")