From eb22b63bb78f7831ae87d9c1e98bc943730e517f Mon Sep 17 00:00:00 2001 From: ashleyzhang01 Date: Fri, 8 Dec 2023 17:58:05 -0500 Subject: [PATCH 1/3] cache page --- backend/gsr_booking/urls.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/gsr_booking/urls.py b/backend/gsr_booking/urls.py index fd10e57e..2d6423f3 100644 --- a/backend/gsr_booking/urls.py +++ b/backend/gsr_booking/urls.py @@ -1,5 +1,7 @@ from django.urls import include, path from rest_framework import routers +from django.views.decorators.cache import cache_page +from utils.cache import Cache from gsr_booking.views import ( Availability, @@ -24,7 +26,8 @@ urlpatterns = [ path("", include(router.urls)), - path("locations/", Locations.as_view(), name="locations"), + path("locations/", Locations.as_view(), + cache_page(Cache.MONTH)(Locations.as_view()), name="locations"), path("recent/", RecentGSRs.as_view(), name="recent-gsrs"), path("wharton/", CheckWharton.as_view(), name="is-wharton"), path("availability//", Availability.as_view(), name="availability"), From 4ff66fe3480e6cb75fe2331ce4560a4c86b1abb8 Mon Sep 17 00:00:00 2001 From: Justin Zhang Date: Fri, 8 Dec 2023 18:13:28 -0500 Subject: [PATCH 2/3] Lint --- backend/gsr_booking/urls.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/gsr_booking/urls.py b/backend/gsr_booking/urls.py index 2d6423f3..ee4eec32 100644 --- a/backend/gsr_booking/urls.py +++ b/backend/gsr_booking/urls.py @@ -1,7 +1,6 @@ from django.urls import include, path -from rest_framework import routers from django.views.decorators.cache import cache_page -from utils.cache import Cache +from rest_framework import routers from gsr_booking.views import ( Availability, @@ -16,6 +15,7 @@ ReservationsView, UserViewSet, ) +from utils.cache import Cache router = routers.DefaultRouter() @@ -26,8 +26,12 @@ urlpatterns = [ path("", include(router.urls)), - path("locations/", Locations.as_view(), - cache_page(Cache.MONTH)(Locations.as_view()), name="locations"), + path( + "locations/", + Locations.as_view(), + cache_page(Cache.MONTH)(Locations.as_view()), + name="locations", + ), path("recent/", RecentGSRs.as_view(), name="recent-gsrs"), path("wharton/", CheckWharton.as_view(), name="is-wharton"), path("availability//", Availability.as_view(), name="availability"), From d630b9a48a86b6dbdf52c37fc0b3f897c2093b7f Mon Sep 17 00:00:00 2001 From: Justin Zhang Date: Fri, 8 Dec 2023 18:16:40 -0500 Subject: [PATCH 3/3] Lint --- backend/gsr_booking/urls.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/backend/gsr_booking/urls.py b/backend/gsr_booking/urls.py index ee4eec32..8baac9d3 100644 --- a/backend/gsr_booking/urls.py +++ b/backend/gsr_booking/urls.py @@ -26,12 +26,7 @@ urlpatterns = [ path("", include(router.urls)), - path( - "locations/", - Locations.as_view(), - cache_page(Cache.MONTH)(Locations.as_view()), - name="locations", - ), + path("locations/", cache_page(Cache.MONTH)(Locations.as_view()), name="locations",), path("recent/", RecentGSRs.as_view(), name="recent-gsrs"), path("wharton/", CheckWharton.as_view(), name="is-wharton"), path("availability//", Availability.as_view(), name="availability"),