From d6eb16a398a8d3a2f58399fd40df7f212680cab0 Mon Sep 17 00:00:00 2001 From: Michael Manfre Date: Mon, 5 Dec 2022 12:55:30 -0500 Subject: Added caching and initial settings --- activities/views/follows.py | 4 ++++ activities/views/posts.py | 2 ++ activities/views/timelines.py | 14 ++++++++++++++ 3 files changed, 20 insertions(+) (limited to 'activities/views') diff --git a/activities/views/follows.py b/activities/views/follows.py index 44d8adc..841c8cc 100644 --- a/activities/views/follows.py +++ b/activities/views/follows.py @@ -1,11 +1,15 @@ from django.utils.decorators import method_decorator from django.views.generic import TemplateView +from core.decorators import per_identity_cache_page from users.decorators import identity_required from users.models import FollowStates @method_decorator(identity_required, name="dispatch") +@method_decorator( + per_identity_cache_page("cache_timeout_page_timeline"), name="dispatch" +) class FollowsPage(TemplateView): """ Shows followers/follows. diff --git a/activities/views/posts.py b/activities/views/posts.py index ef16713..60873a7 100644 --- a/activities/views/posts.py +++ b/activities/views/posts.py @@ -6,11 +6,13 @@ from django.utils.decorators import method_decorator from django.views.generic import TemplateView, View from activities.models import Post, PostInteraction, PostInteractionStates, PostStates +from core.decorators import per_identity_cache_page from core.ld import canonicalise from users.decorators import identity_required from users.shortcuts import by_handle_or_404 +@method_decorator(per_identity_cache_page("cache_timeout_page_post"), name="dispatch") class Individual(TemplateView): template_name = "activities/post.html" diff --git a/activities/views/timelines.py b/activities/views/timelines.py index 753add6..156a20d 100644 --- a/activities/views/timelines.py +++ b/activities/views/timelines.py @@ -5,11 +5,13 @@ from django.utils.decorators import method_decorator from django.views.generic import FormView, ListView from activities.models import Hashtag, Post, PostInteraction, TimelineEvent +from core.decorators import per_identity_cache_page from core.models import Config from users.decorators import identity_required @method_decorator(identity_required, name="dispatch") +@method_decorator(per_identity_cache_page(), name="dispatch") class Home(FormView): template_name = "activities/home.html" @@ -61,6 +63,9 @@ class Home(FormView): return redirect(".") +@method_decorator( + per_identity_cache_page("cache_timeout_page_timeline"), name="dispatch" +) class Tag(ListView): template_name = "activities/tag.html" @@ -96,6 +101,9 @@ class Tag(ListView): return context +@method_decorator( + per_identity_cache_page("cache_timeout_page_timeline"), name="dispatch" +) class Local(ListView): template_name = "activities/local.html" @@ -122,6 +130,9 @@ class Local(ListView): @method_decorator(identity_required, name="dispatch") +@method_decorator( + per_identity_cache_page("cache_timeout_page_timeline"), name="dispatch" +) class Federated(ListView): template_name = "activities/federated.html" @@ -150,6 +161,9 @@ class Federated(ListView): @method_decorator(identity_required, name="dispatch") +@method_decorator( + per_identity_cache_page("cache_timeout_page_timeline"), name="dispatch" +) class Notifications(ListView): template_name = "activities/notifications.html" -- cgit v1.2.3