moviewyrm/bookwyrm/templatetags/book_display_tags.py
2022-01-18 12:28:59 -08:00

18 lines
442 B
Python

""" 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")