From bb5b473898ff08b50dc8650ff35fecdd12fa912b Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 11 Feb 2023 14:54:57 +0000 Subject: [PATCH] Cache more templates --- .../mixins/partials/generic-detail.html | 143 +++++++++--------- .../mixins/window-content/object-form.html | 62 ++++---- .../mixins/window-content/object.html | 85 ++++++----- .../mixins/window-content/objects.html | 2 +- 4 files changed, 150 insertions(+), 142 deletions(-) diff --git a/mixins/templates/mixins/partials/generic-detail.html b/mixins/templates/mixins/partials/generic-detail.html index b7dc105..3fd4f31 100644 --- a/mixins/templates/mixins/partials/generic-detail.html +++ b/mixins/templates/mixins/partials/generic-detail.html @@ -1,72 +1,77 @@ {% load pretty %} -{% include 'mixins/partials/notify.html' %} -{% if live is not None %} -

Live {{ context_object_name_singular }} info

- - - - - - - {% block live_tbody %} - {% for key, item in live.items %} - {% if key in pretty %} - - - - - {% else %} - - - - - {% endif %} - {% endfor %} - {% endblock %} - -
attributevalue
{{ key }} - {% if item is not None %} -
{{ item|pretty }}
- {% endif %} -
{{ key }} - {% if item is not None %} - {{ item }} - {% endif %} -
-{% endif %} +{% load cache %} -{% if object is not None %} -

{{ title_singular }} info

- - - - - - - {% block tbody %} - {% for key, item in object.items %} - {% if key in pretty %} - - - - - {% else %} - - - - - {% endif %} - {% endfor %} - {% endblock %} - -
attributevalue
{{ key }} - {% if item is not None %} -
{{ item|pretty }}
- {% endif %} -
{{ key }} - {% if item is not None %} - {{ item }} - {% endif %} -
-{% endif %} \ No newline at end of file +{% cache 600 generic_detail request.user.id object live %} + {% include 'mixins/partials/notify.html' %} + + {% if live is not None %} +

Live {{ context_object_name_singular }} info

+ + + + + + + {% block live_tbody %} + {% for key, item in live.items %} + {% if key in pretty %} + + + + + {% else %} + + + + + {% endif %} + {% endfor %} + {% endblock %} + +
attributevalue
{{ key }} + {% if item is not None %} +
{{ item|pretty }}
+ {% endif %} +
{{ key }} + {% if item is not None %} + {{ item }} + {% endif %} +
+ {% endif %} + + {% if object is not None %} +

{{ title_singular }} info

+ + + + + + + {% block tbody %} + {% for key, item in object.items %} + {% if key in pretty %} + + + + + {% else %} + + + + + {% endif %} + {% endfor %} + {% endblock %} + +
attributevalue
{{ key }} + {% if item is not None %} +
{{ item|pretty }}
+ {% endif %} +
{{ key }} + {% if item is not None %} + {{ item }} + {% endif %} +
+ {% endif %} +{% endcache %} \ No newline at end of file diff --git a/mixins/templates/mixins/window-content/object-form.html b/mixins/templates/mixins/window-content/object-form.html index 0cf755e..e1e8006 100644 --- a/mixins/templates/mixins/window-content/object-form.html +++ b/mixins/templates/mixins/window-content/object-form.html @@ -1,34 +1,32 @@ -{% include 'mixins/partials/notify.html' %} -{% if page_title is not None %} -

{{ page_title }}

-{% endif %} -{% if page_subtitle is not None %} -

{{ page_subtitle }}

-{% endif %} -{% load crispy_forms_tags %} - -{% load crispy_forms_bulma_field %} -
- {% csrf_token %} - {{ form|crispy }} - {% if hide_cancel is not True %} - - {% endif %} - -
- - - - - - +{% load cache %} +{% cache 600 object_form request.user.id form %} + {% include 'mixins/partials/notify.html' %} + {% if page_title is not None %} +

{{ page_title }}

+ {% endif %} + {% if page_subtitle is not None %} +

{{ page_subtitle }}

+ {% endif %} + {% load crispy_forms_tags %} + + {% load crispy_forms_bulma_field %} +
+ {% csrf_token %} + {{ form|crispy }} + {% if hide_cancel is not True %} + + {% endif %} + +
+ +{% endcache %} \ No newline at end of file diff --git a/mixins/templates/mixins/window-content/object.html b/mixins/templates/mixins/window-content/object.html index 343ae7c..c27de2e 100644 --- a/mixins/templates/mixins/window-content/object.html +++ b/mixins/templates/mixins/window-content/object.html @@ -1,45 +1,50 @@ -{% include 'mixins/partials/notify.html' %} -{% if page_title is not None %} -

{{ page_title }}

-{% endif %} -{% if page_subtitle is not None %} -

{{ page_subtitle }}

-{% endif %} -
+{% load cache %} - {% if submit_url is not None %} - +{% cache 600 object request.user.id object %} + + {% include 'mixins/partials/notify.html' %} + {% if page_title is not None %} +

{{ page_title }}

{% endif %} - {% if delete_all_url is not None %} - + {% if page_subtitle is not None %} +

{{ page_subtitle }}

{% endif %} -
+
+ + {% if submit_url is not None %} + + {% endif %} + {% if delete_all_url is not None %} + + {% endif %} +
-{% include detail_template %} + {% include detail_template %} +{% endcache %} \ No newline at end of file diff --git a/mixins/templates/mixins/window-content/objects.html b/mixins/templates/mixins/window-content/objects.html index f5c7dc7..9092db6 100644 --- a/mixins/templates/mixins/window-content/objects.html +++ b/mixins/templates/mixins/window-content/objects.html @@ -1,6 +1,6 @@ {% load cache %} -{% cache 60 objects request.user.id object_list %} +{% cache 600 objects request.user.id object_list %} {% include 'mixins/partials/notify.html' %} {% if page_title is not None %}

{{ page_title }}