X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/92cd6e14d1d6ea7b93f6fc9694b93c782a8bbc8b..a8828a545c78f34a9b5bfaff8905eccc8985ff23:/apps/catalogue/views.py 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())