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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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