From 1ca64302e8447c9715ab42dd1a33075f312e6059 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Tue, 16 Feb 2016 12:16:03 +0100 Subject: [PATCH] =?utf8?q?#12=20wystawione=2020=20najpopularniejszych=20ks?= =?utf8?q?i=C4=85=C5=BCek?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../catalogue/tagged_object_list.html | 18 ++++++++++-------- src/catalogue/views.py | 3 +++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/catalogue/templates/catalogue/tagged_object_list.html b/src/catalogue/templates/catalogue/tagged_object_list.html index b8eea9c7f..9af03f51e 100644 --- a/src/catalogue/templates/catalogue/tagged_object_list.html +++ b/src/catalogue/templates/catalogue/tagged_object_list.html @@ -9,11 +9,7 @@ {% block body %}
-

{% if tags %} - {% html_title_from_tags tags %} - {% elif list_type == 'gallery' %}{% trans "Gallery" %}{% elif list_type == 'audiobooks' %}{% trans "Audiobooks" %}{% else %}{% trans "Literature" %} - {% endif %} -

+

{% if tags %}{% html_title_from_tags tags %}{% endif %}

{% trans "Authors" %} @@ -49,11 +45,17 @@ {% if list_type == 'books' and not tags %}

{% trans "Recent publications" %}

- {% for book in last_published %} - {% ssi_include 'catalogue_book_mini' pk=book.pk %} - {% endfor %} + {% for book in last_published %} + {% ssi_include 'catalogue_book_mini' pk=book.pk %} + {% endfor %} {% trans "More recent publications" %}
+
+

{% trans "Most popular books" %}

+ {% for book in most_popular %} + {% ssi_include 'catalogue_book_mini' pk=book.pk %} + {% endfor %} +
{% endif %} {% if theme_is_set %} diff --git a/src/catalogue/views.py b/src/catalogue/views.py index b39bb8715..12cfdc577 100644 --- a/src/catalogue/views.py +++ b/src/catalogue/views.py @@ -236,8 +236,10 @@ def tagged_object_list(request, tags='', list_type='books'): # this is becoming more and more hacky if list_type == 'books' and not tags: last_published = Book.objects.exclude(cover_thumb='').filter(parent=None).order_by('-created_at')[:20] + most_popular = Book.objects.exclude(cover_thumb='').order_by('-popularity__count')[:20] else: last_published = None + most_popular = None return render_to_response( 'catalogue/tagged_object_list.html', @@ -254,6 +256,7 @@ def tagged_object_list(request, tags='', list_type='books'): 'list_type': list_type, 'daisy': daisy, 'last_published': last_published, + 'most_popular': most_popular, 'active_menu_item': 'theme' if theme_is_set else list_type, }, context_instance=RequestContext(request)) -- 2.20.1