Cache all object list templates

This commit is contained in:
Mark Veidemanis 2023-02-11 14:52:00 +00:00
parent 0acddb2048
commit a0c94b2097
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
16 changed files with 1000 additions and 967 deletions

View File

@ -68,6 +68,9 @@ CACHES = {
},
}
}
# CACHE_MIDDLEWARE_ALIAS = 'default'
# CACHE_MIDDLEWARE_SECONDS = '600'
# CACHE_MIDDLEWARE_KEY_PREFIX = ''
CRISPY_TEMPLATE_PACK = "bulma"
CRISPY_ALLOWED_TEMPLATE_PACKS = ("bulma",)
@ -77,16 +80,15 @@ 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_otp.middleware.OTPMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"django_htmx.middleware.HtmxMiddleware",
# 'django.middleware.cache.UpdateCacheMiddleware',
# 'django.middleware.common.CommonMiddleware',
# 'django.middleware.cache.FetchFromCacheMiddleware',
]
ROOT_URLCONF = "app.urls"

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
{% load cache %}
{% include 'mixins/partials/notify.html' %}
<table class="table is-fullwidth is-hoverable" id="callbacks-table">
{% cache 600 objects_callbacks request.user.id object_list %}
<table class="table is-fullwidth is-hoverable" id="callbacks-table">
<thead>
<th>id</th>
<th>hook id</th>
@ -47,4 +48,5 @@
</tr>
{% endfor %}
</table>
</table>
{% endcache %}

View File

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

View File

@ -1,6 +1,8 @@
{% extends 'partials/generic-detail.html' %}
{% load cache %}
{% block tbody %}
{% cache 600 object_position_detail request.user.id object %}
{% for key, item in object.items %}
<tr>
{% if key == 'trade_ids' %}
@ -30,4 +32,5 @@
{% endif %}
</tr>
{% endfor %}
{% endcache %}
{% endblock %}

View File

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

View File

@ -1,8 +1,9 @@
{% 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 +44,6 @@
</div>
</article>
</div>
{% endfor %}
{% endfor %}
{% endcache %}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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