From 9181e77d5507e3eb827726753608f6c2e24c370b Mon Sep 17 00:00:00 2001 From: Bartuccio Antoine Date: Mon, 9 Sep 2019 01:20:15 +0200 Subject: [PATCH] core: add some cache on birthdays and counters_activity --- com/templates/com/news_list.jinja | 3 +++ core/templates/core/base.jinja | 32 ++++++++++++++++--------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/com/templates/com/news_list.jinja b/com/templates/com/news_list.jinja index d3e3016b..7c2ec629 100644 --- a/com/templates/com/news_list.jinja +++ b/com/templates/com/news_list.jinja @@ -42,6 +42,8 @@
{% trans %}Birthdays{% endtrans %}
{% if user.is_subscribed %} + {# Cache request for 1 hour #} + {% cache 3600 birthdays %} + {% endcache %} {% else %}

{% trans %}You need an up to date subscription to access this content{% endtrans %}

{% endif %} diff --git a/core/templates/core/base.jinja b/core/templates/core/base.jinja index 9d0e53cc..43d2a058 100644 --- a/core/templates/core/base.jinja +++ b/core/templates/core/base.jinja @@ -60,21 +60,23 @@
+ {% cache 100 counters_activity %} + {% for bar in Counter.objects.filter(type="BAR").all() %} +
  • + + {% if bar.is_inactive(): %} + + {% elif bar.is_open(): %} + + {% else %} + + {% endif %} + {{ bar }} + +
  • + {% endfor %} + + {% endcache %}