From 7bdcaccc3d4a6c7ec36a62d5f0f4fd2b7a00fe84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matja=C5=BE=20Horvat?= Date: Mon, 12 Feb 2024 21:03:30 +0100 Subject: [PATCH] Cache insights views (#3095) --- pontoon/insights/urls.py | 9 ++++++++- pontoon/localizations/urls.py | 2 +- pontoon/projects/urls.py | 2 +- pontoon/teams/urls.py | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pontoon/insights/urls.py b/pontoon/insights/urls.py index dbaabe38ad..c6859c4b4d 100644 --- a/pontoon/insights/urls.py +++ b/pontoon/insights/urls.py @@ -1,8 +1,15 @@ from django.urls import path +from django.views.decorators.cache import cache_page + +from pontoon.settings import VIEW_CACHE_TIMEOUT from . import views urlpatterns = [ # Insights page - path("insights/", views.insights, name="pontoon.insights"), + path( + "insights/", + cache_page(VIEW_CACHE_TIMEOUT)(views.insights), + name="pontoon.insights", + ), ] diff --git a/pontoon/localizations/urls.py b/pontoon/localizations/urls.py index a211c69085..ca1668c702 100644 --- a/pontoon/localizations/urls.py +++ b/pontoon/localizations/urls.py @@ -76,7 +76,7 @@ # Project insights path( "insights/", - views.ajax_insights, + cache_page(VIEW_CACHE_TIMEOUT)(views.ajax_insights), name="pontoon.localizations.ajax.insights", ), ] diff --git a/pontoon/projects/urls.py b/pontoon/projects/urls.py index 35ad9a4635..6c4d7989a6 100644 --- a/pontoon/projects/urls.py +++ b/pontoon/projects/urls.py @@ -81,7 +81,7 @@ # Project insights path( "insights/", - views.ajax_insights, + cache_page(VIEW_CACHE_TIMEOUT)(views.ajax_insights), name="pontoon.projects.ajax.insights", ), # Project info diff --git a/pontoon/teams/urls.py b/pontoon/teams/urls.py index cb3fc0f6ba..7a85a53d81 100644 --- a/pontoon/teams/urls.py +++ b/pontoon/teams/urls.py @@ -81,7 +81,7 @@ # Team insights path( "insights/", - views.ajax_insights, + cache_page(VIEW_CACHE_TIMEOUT)(views.ajax_insights), name="pontoon.teams.ajax.insights", ), # Team info