From: Radek Czajka Date: Fri, 13 Aug 2010 08:41:58 +0000 (+0200) Subject: Fixes #309: breadcrumbs to parent books X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/a8828a545c78f34a9b5bfaff8905eccc8985ff23?hp=-c Fixes #309: breadcrumbs to parent books --- a8828a545c78f34a9b5bfaff8905eccc8985ff23 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 %}