From 16926672fd1edefa55acf4159f8b5d9b6aef5b8a Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Thu, 11 Feb 2016 16:43:48 +0100 Subject: [PATCH] =?utf8?q?#12=20wst=C4=99pnie=20wystawione=2020=20najnowsz?= =?utf8?q?ych=20ksi=C4=85=C5=BCek?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../templates/catalogue/tagged_object_list.html | 10 ++++++++++ src/catalogue/views.py | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/src/catalogue/templates/catalogue/tagged_object_list.html b/src/catalogue/templates/catalogue/tagged_object_list.html index e66348676..06947e3a7 100644 --- a/src/catalogue/templates/catalogue/tagged_object_list.html +++ b/src/catalogue/templates/catalogue/tagged_object_list.html @@ -46,6 +46,16 @@ {% endif %} +{% if list_type == 'default' and not tags %} +
+

{% trans "Recent publications" %}

+ {% for book in last_published %} + {% ssi_include 'catalogue_book_mini' pk=book.pk %} + {% endfor %} + {% trans "More recent publications" %} +
+{% endif %} + {% if theme_is_set %} {% work_list object_list %} {% else %} diff --git a/src/catalogue/views.py b/src/catalogue/views.py index e2d449c30..47706240c 100644 --- a/src/catalogue/views.py +++ b/src/catalogue/views.py @@ -232,6 +232,12 @@ def tagged_object_list(request, tags='', list_type='default'): Picture.tagged.with_any([tag]).exists()): return redirect('tagged_object_list_gallery', raw_tags) + # this is becoming more and more hacky + if list_type == 'default' and not tags: + last_published = Book.objects.exclude(cover_thumb='').filter(parent=None).order_by('-created_at')[:20] + else: + last_published = None + return render_to_response( 'catalogue/tagged_object_list.html', { @@ -246,6 +252,7 @@ def tagged_object_list(request, tags='', list_type='default'): 'best': best, 'list_type': list_type, 'daisy': daisy, + 'last_published': last_published, }, context_instance=RequestContext(request)) -- 2.20.1