diff --git a/app/settings.py b/app/settings.py
index 54c340b..b673e4d 100644
--- a/app/settings.py
+++ b/app/settings.py
@@ -44,6 +44,7 @@ INSTALLED_APPS = [
"django_tables2_bulma_template",
"prettyjson",
"mixins",
+ "cachalot",
]
# Performance optimisations
@@ -181,6 +182,7 @@ DEBUG_TOOLBAR_PANELS = [
"debug_toolbar.panels.logging.LoggingPanel",
"debug_toolbar.panels.redirects.RedirectsPanel",
"debug_toolbar.panels.profiling.ProfilingPanel",
+ "cachalot.panels.CachalotPanel",
]
from app.local_settings import * # noqa
diff --git a/core/models.py b/core/models.py
index c32e313..1958e6b 100644
--- a/core/models.py
+++ b/core/models.py
@@ -214,15 +214,6 @@ class NotificationRule(models.Model):
raise ValueError(f"Invalid YAML: {e}")
return parsed
- @property
- def matches(self):
- """
- Get the total number of matches for this rule.
- """
- if isinstance(self.match, dict):
- truthy_values = [x for x in self.match.values() if x is not False]
- return f"{len(truthy_values)}/{len(self.match)}"
-
def get_notification_settings(self, check=True):
"""
Get the notification settings for this rule.
diff --git a/core/templates/partials/product-list.html b/core/templates/partials/product-list.html
index 89c2d26..1a8671d 100644
--- a/core/templates/partials/product-list.html
+++ b/core/templates/partials/product-list.html
@@ -1,7 +1,8 @@
{% load static %}
{% load cache %}
-
-{% cache 600 objects_plans request.user.id plans %}
+{% load cachalot cache %}
+{% get_last_invalidation 'core.Plan' as last %}
+{% cache 600 objects_plans request.user.id plans last %}
{% for plan in plans %}
diff --git a/core/templates/partials/rule-list.html b/core/templates/partials/rule-list.html
index 89f8561..864013f 100644
--- a/core/templates/partials/rule-list.html
+++ b/core/templates/partials/rule-list.html
@@ -1,6 +1,8 @@
{% load cache %}
+{% load cachalot cache %}
+{% get_last_invalidation 'core.NotificationRule' as last %}
{% include 'mixins/partials/notify.html' %}
-{% cache 600 objects_rules request.user.id object_list %}
+{% cache 600 objects_rules request.user.id object_list last %}
topic
enabled |
data length |
- match |
actions |
{% for item in object_list %}
@@ -42,7 +43,6 @@
{% endif %}
{{ item.data|length }} |
- {{ item.matches }} |
|