X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/f43bad97b17e376293c0a72e9c1726733fc285fa..b609bf3ae5d77cc2bf6d90791a0d248e687f53d0:/apps/catalogue/templatetags/catalogue_tags.py?ds=sidebyside
diff --git a/apps/catalogue/templatetags/catalogue_tags.py b/apps/catalogue/templatetags/catalogue_tags.py
index e8bc13899..14ed64da8 100644
--- a/apps/catalogue/templatetags/catalogue_tags.py
+++ b/apps/catalogue/templatetags/catalogue_tags.py
@@ -148,6 +148,17 @@ def book_tree(book_list, books_by_parent):
else:
return ''
+@register.simple_tag
+def audiobook_tree(book_list, books_by_parent):
+ text = "".join("
%s%s" % (
+ reverse("book_player", args=[book.slug]), book.title, audiobook_tree(books_by_parent.get(book, ()), books_by_parent)
+ ) for book in book_list)
+
+ if text:
+ return "%s
" % text
+ else:
+ return ''
+
@register.simple_tag
def book_tree_texml(book_list, books_by_parent, depth=1):
return "".join("""
@@ -350,7 +361,6 @@ def related_books(book, limit=6, random=1):
cache_key = "catalogue.related_books.%d.%d" % (book.id, limit - random)
related = cache.get(cache_key)
if related is None:
- print 'not in cache'
related = list(Book.objects.filter(
common_slug=book.common_slug).exclude(pk=book.pk)[:limit])
limit -= len(related)