From: Jan Szejko Date: Tue, 3 Jul 2018 10:09:29 +0000 (+0200) Subject: vary template cache on language X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/2983d583c9de4c33ed73d6c06d9d6eb54b30f15e vary template cache on language --- diff --git a/src/catalogue/templates/catalogue/book_detail.html b/src/catalogue/templates/catalogue/book_detail.html index 3b13624a4..cf26b125a 100644 --- a/src/catalogue/templates/catalogue/book_detail.html +++ b/src/catalogue/templates/catalogue/book_detail.html @@ -13,7 +13,8 @@ {% block bodyid %}book-detail{% endblock %} {% block body %} - {% cache 86400 book_wide book.pk book|status:user %} + {% get_current_language as LANGUAGE_CODE %} + {% cache 86400 book_wide book.pk book|status:user LANGUAGE_CODE %} {% include 'catalogue/book_wide.html' %} {% endcache %} diff --git a/src/catalogue/templates/catalogue/book_text.html b/src/catalogue/templates/catalogue/book_text.html index f697e4ee2..5894fe825 100644 --- a/src/catalogue/templates/catalogue/book_text.html +++ b/src/catalogue/templates/catalogue/book_text.html @@ -110,7 +110,8 @@
- {% cache 86400 catalogue_book_short book.pk book|status:user %} + {% get_current_language as LANGUAGE_CODE %} + {% cache 86400 book_short book.pk book|status:user LANGUAGE_CODE %} {% include 'catalogue/book_short.html' %} {% endcache %}
diff --git a/src/catalogue/templates/catalogue/work-list.html b/src/catalogue/templates/catalogue/work-list.html index 03833c16f..178654c70 100755 --- a/src/catalogue/templates/catalogue/work-list.html +++ b/src/catalogue/templates/catalogue/work-list.html @@ -1,7 +1,10 @@ {% spaceless %} + {% load cache %} + {% load i18n %} {% load pagination_tags %} {% load class_name from catalogue_tags %} + {% load status from catalogue_tags %} {% load ssi_include from ssify %} {% autopaginate object_list 10 %} @@ -9,7 +12,14 @@
    {% for item in object_list %}
  1. - {% ssi_include item.short_html_url_name pk=item.pk %} + {% if item|class_name == 'Book' %} + {% get_current_language as LANGUAGE_CODE %} + {% cache 86400 book_short item.pk item|status:request.user LANGUAGE_CODE %} + {% include "catalogue/book_short.html" with book=item %} + {% endcache %} + {% else %} + {% ssi_include item.short_html_url_name pk=item.pk %} + {% endif %}
  2. {% endfor %}