Cache more templates

This commit is contained in:
Mark Veidemanis 2023-02-11 14:54:57 +00:00
parent eba4142960
commit bb5b473898
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
4 changed files with 148 additions and 140 deletions

View File

@ -1,7 +1,11 @@
{% load pretty %} {% load pretty %}
{% include 'mixins/partials/notify.html' %}
{% if live is not None %} {% load cache %}
{% cache 600 generic_detail request.user.id object live %}
{% include 'mixins/partials/notify.html' %}
{% if live is not None %}
<h1 class="title">Live {{ context_object_name_singular }} info</h1> <h1 class="title">Live {{ context_object_name_singular }} info</h1>
<table class="table is-fullwidth is-hoverable"> <table class="table is-fullwidth is-hoverable">
<thead> <thead>
@ -34,9 +38,9 @@
{% endblock %} {% endblock %}
</tbody> </tbody>
</table> </table>
{% endif %} {% endif %}
{% if object is not None %} {% if object is not None %}
<h1 class="title">{{ title_singular }} info</h1> <h1 class="title">{{ title_singular }} info</h1>
<table class="table is-fullwidth is-hoverable"> <table class="table is-fullwidth is-hoverable">
<thead> <thead>
@ -69,4 +73,5 @@
{% endblock %} {% endblock %}
</tbody> </tbody>
</table> </table>
{% endif %} {% endif %}
{% endcache %}

View File

@ -1,14 +1,18 @@
{% include 'mixins/partials/notify.html' %} {% load cache %}
{% if page_title is not None %}
<h1 class="title is-4">{{ page_title }}</h1>
{% endif %}
{% if page_subtitle is not None %}
<h1 class="subtitle">{{ page_subtitle }}</h1>
{% endif %}
{% load crispy_forms_tags %}
{% load crispy_forms_bulma_field %} {% cache 600 object_form request.user.id form %}
<form
{% include 'mixins/partials/notify.html' %}
{% if page_title is not None %}
<h1 class="title is-4">{{ page_title }}</h1>
{% endif %}
{% if page_subtitle is not None %}
<h1 class="subtitle">{{ page_subtitle }}</h1>
{% endif %}
{% load crispy_forms_tags %}
{% load crispy_forms_bulma_field %}
<form
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}' hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-post="{{ submit_url }}" hx-post="{{ submit_url }}"
hx-target="#modals-here" hx-target="#modals-here"
@ -23,12 +27,6 @@
</button> </button>
{% endif %} {% endif %}
<button type="submit" class="button modal-close-button">Submit</button> <button type="submit" class="button modal-close-button">Submit</button>
</form> </form>
{% endcache %}

View File

@ -1,11 +1,15 @@
{% include 'mixins/partials/notify.html' %} {% load cache %}
{% if page_title is not None %}
{% cache 600 object request.user.id object %}
{% include 'mixins/partials/notify.html' %}
{% if page_title is not None %}
<h1 class="title is-4">{{ page_title }}</h1> <h1 class="title is-4">{{ page_title }}</h1>
{% endif %} {% endif %}
{% if page_subtitle is not None %} {% if page_subtitle is not None %}
<h1 class="subtitle">{{ page_subtitle }}</h1> <h1 class="subtitle">{{ page_subtitle }}</h1>
{% endif %} {% endif %}
<div class="buttons"> <div class="buttons">
{% if submit_url is not None %} {% if submit_url is not None %}
<button <button
@ -39,7 +43,8 @@
</span> </span>
</button> </button>
{% endif %} {% endif %}
</div> </div>
{% include detail_template %} {% include detail_template %}
{% endcache %}

View File

@ -1,6 +1,6 @@
{% load cache %} {% load cache %}
{% cache 60 objects request.user.id object_list %} {% cache 600 objects request.user.id object_list %}
{% include 'mixins/partials/notify.html' %} {% include 'mixins/partials/notify.html' %}
{% if page_title is not None %} {% if page_title is not None %}
<h1 class="title is-4">{{ page_title }}</h1> <h1 class="title is-4">{{ page_title }}</h1>