Commit 9181e77d authored by Sli's avatar Sli

core: add some cache on birthdays and counters_activity

parent f1b3a174
Pipeline #2006 passed with stage
in 24 minutes and 15 seconds
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
<div id="birthdays_title">{% trans %}Birthdays{% endtrans %}</div> <div id="birthdays_title">{% trans %}Birthdays{% endtrans %}</div>
<div id="birthdays_content"> <div id="birthdays_content">
{% if user.is_subscribed %} {% if user.is_subscribed %}
{# Cache request for 1 hour #}
{% cache 3600 birthdays %}
<ul class="birthdays_year"> <ul class="birthdays_year">
{% for d in birthdays.dates('date_of_birth', 'year', 'DESC') %} {% for d in birthdays.dates('date_of_birth', 'year', 'DESC') %}
<li> <li>
...@@ -54,6 +56,7 @@ ...@@ -54,6 +56,7 @@
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endcache %}
{% else %} {% else %}
<p>{% trans %}You need an up to date subscription to access this content{% endtrans %}</p> <p>{% trans %}You need an up to date subscription to access this content{% endtrans %}</p>
{% endif %} {% endif %}
......
...@@ -60,21 +60,23 @@ ...@@ -60,21 +60,23 @@
</div> </div>
<div id="header_bar"> <div id="header_bar">
<ul id="header_bars_infos"> <ul id="header_bars_infos">
{% for bar in Counter.objects.filter(type="BAR").all() %} {% cache 100 counters_activity %}
<li> {% for bar in Counter.objects.filter(type="BAR").all() %}
<a href="{{ url('counter:activity', counter_id=bar.id) }}" style="padding: 0px"> <li>
{% if bar.is_inactive(): %} <a href="{{ url('counter:activity', counter_id=bar.id) }}" style="padding: 0px">
<i class="fa fa-question" style="color: #f39c12"></i> {% if bar.is_inactive(): %}
{% elif bar.is_open(): %} <i class="fa fa-question" style="color: #f39c12"></i>
<i class="fa fa-check" style="color: #2ecc71"></i> {% elif bar.is_open(): %}
{% else %} <i class="fa fa-check" style="color: #2ecc71"></i>
<i class="fa fa-times" style="color: #eb2f06"></i> {% else %}
{% endif %} <i class="fa fa-times" style="color: #eb2f06"></i>
{{ bar }} {% endif %}
</a> {{ bar }}
</li> </a>
{% endfor %} </li>
</ul> {% endfor %}
</ul>
{% endcache %}
<form action="{{ url('core:search') }}" method="GET" id="header_search"> <form action="{{ url('core:search') }}" method="GET" id="header_search">
<input type="text" placeholder="{% trans %}Search{% endtrans %}" name="query" id="search" /> <input type="text" placeholder="{% trans %}Search{% endtrans %}" name="query" id="search" />
<input type="submit" value="{% trans %}Search{% endtrans %}" style="display: none;" /> <input type="submit" value="{% trans %}Search{% endtrans %}" style="display: none;" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment