From f40681d06a88224863d5981997a6638a14d5723e Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 4 Sep 2022 17:34:04 +0100 Subject: [PATCH] Add caching to listing feeds --- website/common/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/common/models.py b/website/common/models.py index 557e32b..2df3c26 100644 --- a/website/common/models.py +++ b/website/common/models.py @@ -8,8 +8,10 @@ from django.core.paginator import Paginator from django.db import models from django.http.request import HttpRequest from django.http.response import Http404, HttpResponse, HttpResponseBadRequest +from django.utils.decorators import method_decorator from django.utils.functional import cached_property, classproperty from django.utils.text import slugify +from django.views.decorators.cache import cache_page from wagtail.admin.panels import FieldPanel from wagtail.contrib.routable_page.models import RoutablePageMixin, route from wagtail.contrib.settings.models import BaseSetting, register_setting @@ -221,6 +223,7 @@ class BaseListingPage(RoutablePageMixin, BaseContentPage): return super().index_route(request) @route(r"^feed/$") + @method_decorator(cache_page(60 * 30)) def feed(self, request: HttpRequest) -> HttpResponse: return self.feed_class( self.get_listing_pages(),