Remove caching from common object templates

This commit is contained in:
Mark Veidemanis 2023-02-11 17:59:31 +00:00
parent 502556e7c3
commit 3d7c3504aa
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 80 additions and 91 deletions

View File

@ -1,50 +1,44 @@
{% load cache %} {% 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 %}
<div class="buttons">
{% cache 600 object request.user.id object %} {% if submit_url is not None %}
<button
{% include 'mixins/partials/notify.html' %} hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
{% if page_title is not None %} hx-get="{{ submit_url }}"
<h1 class="title is-4">{{ page_title }}</h1> hx-trigger="click"
{% endif %} hx-target="#modals-here"
{% if page_subtitle is not None %} class="button">
<h1 class="subtitle">{{ page_subtitle }}</h1> <span class="icon-text">
{% endif %} <span class="icon">
<div class="buttons"> <i class="fa-solid fa-plus"></i>
{% if submit_url is not None %}
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{{ submit_url }}"
hx-trigger="click"
hx-target="#modals-here"
class="button">
<span class="icon-text">
<span class="icon">
<i class="fa-solid fa-plus"></i>
</span>
<span>{{ title_singular }}</span>
</span> </span>
</button> <span>{{ title_singular }}</span>
{% endif %} </span>
{% if delete_all_url is not None %} </button>
<button {% endif %}
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}' {% if delete_all_url is not None %}
hx-delete="{{ delete_all_url }}" <button
hx-trigger="click" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-target="#modals-here" hx-delete="{{ delete_all_url }}"
hx-swap="innerHTML" hx-trigger="click"
hx-confirm="Are you sure you wish to delete all {{ context_object_name }}?" hx-target="#modals-here"
class="button"> hx-swap="innerHTML"
<span class="icon-text"> hx-confirm="Are you sure you wish to delete all {{ context_object_name }}?"
<span class="icon"> class="button">
<i class="fa-solid fa-xmark"></i> <span class="icon-text">
</span> <span class="icon">
<span>Delete all {{ context_object_name }} </span> <i class="fa-solid fa-xmark"></i>
</span> </span>
</button> <span>Delete all {{ context_object_name }} </span>
{% endif %} </span>
</div> </button>
{% endif %}
</div>
{% include detail_template %} {% include detail_template %}
{% endcache %}

View File

@ -1,49 +1,44 @@
{% load cache %} {% 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 %}
<div class="buttons">
{% cache 600 objects request.user.id object_list %} {% if submit_url is not None %}
{% include 'mixins/partials/notify.html' %} <button
{% if page_title is not None %} hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
<h1 class="title is-4">{{ page_title }}</h1> hx-get="{{ submit_url }}"
{% endif %} hx-trigger="click"
{% if page_subtitle is not None %} hx-target="#modals-here"
<h1 class="subtitle">{{ page_subtitle }}</h1> class="button">
{% endif %} <span class="icon-text">
<div class="buttons"> <span class="icon">
<i class="fa-solid fa-plus"></i>
{% if submit_url is not None %}
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{{ submit_url }}"
hx-trigger="click"
hx-target="#modals-here"
class="button">
<span class="icon-text">
<span class="icon">
<i class="fa-solid fa-plus"></i>
</span>
<span>{{ title_singular }}</span>
</span> </span>
</button> <span>{{ title_singular }}</span>
{% endif %} </span>
{% if delete_all_url is not None %} </button>
<button {% endif %}
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}' {% if delete_all_url is not None %}
hx-delete="{{ delete_all_url }}" <button
hx-trigger="click" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-target="#modals-here" hx-delete="{{ delete_all_url }}"
hx-swap="innerHTML" hx-trigger="click"
hx-confirm="Are you sure you wish to delete all {{ context_object_name }}?" hx-target="#modals-here"
class="button"> hx-swap="innerHTML"
<span class="icon-text"> hx-confirm="Are you sure you wish to delete all {{ context_object_name }}?"
<span class="icon"> class="button">
<i class="fa-solid fa-xmark"></i> <span class="icon-text">
</span> <span class="icon">
<span>Delete all {{ context_object_name }} </span> <i class="fa-solid fa-xmark"></i>
</span> </span>
</button> <span>Delete all {{ context_object_name }} </span>
{% endif %} </span>
</div> </button>
{% endif %}
</div>
{% include list_template %} {% include list_template %}
{% endcache %}