diff --git a/config/settings/base.py b/config/settings/base.py index 576b3c979..bd31cfe98 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -459,8 +459,8 @@ def safe_key() -> str: 'rest_framework.throttling.UserRateThrottle' ], 'DEFAULT_THROTTLE_RATES': { - 'anon': '4/sec', - 'user': '4/sec' + 'anon': '4/second', + 'user': '4/second' } } diff --git a/metadeploy/api/views.py b/metadeploy/api/views.py index 9c3a30faf..da63c7e83 100644 --- a/metadeploy/api/views.py +++ b/metadeploy/api/views.py @@ -2,6 +2,8 @@ from functools import reduce from logging import getLogger from pathlib import Path +from django.utils.decorators import method_decorator +from django.views.decorators.cache import cache_page import django_rq from django.conf import settings @@ -157,6 +159,10 @@ class ProductCategoryViewSet(viewsets.ReadOnlyModelViewSet): serializer_class = ProductCategorySerializer queryset = ProductCategory.objects.all() + @method_decorator(cache_page(60*60*2)) + def list(self, *args, **kwargs): + return super().list(*args, **kwargs) # pragma: nocover + class ProductViewSet( FilterAllowedByOrgMixin, GetOneMixin, viewsets.ReadOnlyModelViewSet