Cache more object lists

This commit is contained in:
Mark Veidemanis 2023-02-11 14:58:36 +00:00
parent 40a710f41e
commit 5d6f96bbf3
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
3 changed files with 137 additions and 134 deletions

View File

@ -67,7 +67,9 @@ MIDDLEWARE = [
"debug_toolbar.middleware.DebugToolbarMiddleware",
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
# 'django.middleware.cache.UpdateCacheMiddleware',
"django.middleware.common.CommonMiddleware",
# 'django.middleware.cache.FetchFromCacheMiddleware',
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",

View File

@ -1,8 +1,8 @@
{% load static %}
{% load cache %}
{% for plan in plans %}
{% cache 600 objects_plans request.user.id plans %}
{% for plan in plans %}
<div class="box">
<article class="media">
<div class="media-left">
@ -43,6 +43,5 @@
</div>
</article>
</div>
{% endfor %}
{% endfor %}
{% endcache %}

View File

@ -1,6 +1,7 @@
{% load cache %}
{% include 'mixins/partials/notify.html' %}
<table
{% cache 600 objects_rules request.user.id object_list %}
<table
class="table is-fullwidth is-hoverable"
hx-target="#{{ context_object_name }}-table"
id="{{ context_object_name }}-table"
@ -90,4 +91,5 @@
</tr>
{% endfor %}
</table>
</table>
{% endcache %}