From a8828a545c78f34a9b5bfaff8905eccc8985ff23 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 13 Aug 2010 10:41:58 +0200 Subject: [PATCH 1/1] Fixes #309: breadcrumbs to parent books --- apps/catalogue/views.py | 7 +++++++ wolnelektury/templates/catalogue/book_detail.html | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index e7df9bc5d..617d19f94 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -214,6 +214,13 @@ def book_detail(request, slug): tags = list(book.tags.filter(~Q(category='set'))) categories = split_tags(tags) book_children = book.children.all().order_by('parent_number') + + _book = book + parents = [] + while _book.parent: + parents.append(_book.parent) + _book = _book.parent + parents = reversed(parents) theme_counter = book.theme_counter book_themes = models.Tag.objects.filter(pk__in=theme_counter.keys()) diff --git a/wolnelektury/templates/catalogue/book_detail.html b/wolnelektury/templates/catalogue/book_detail.html index b9faea6fb..cb5dee0d9 100644 --- a/wolnelektury/templates/catalogue/book_detail.html +++ b/wolnelektury/templates/catalogue/book_detail.html @@ -13,6 +13,15 @@
+ {% if parents %} + + {% endif %} + {% if extra_info.license %}

{% trans "Work is licensed under " %} {{ extra_info.license_description }}.

{% endif %} -- 2.20.1