Reduce cache timeout for reports and labels
This commit is contained in:
parent
4e72ac303f
commit
86ad247c50
|
|
@ -5,7 +5,7 @@ from django.core.exceptions import FieldError, ValidationError
|
|||
from django.http import HttpResponse, JsonResponse
|
||||
from django.urls import include, re_path
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.decorators.cache import cache_page, never_cache
|
||||
from django.views.decorators.cache import cache_page
|
||||
|
||||
from django_filters.rest_framework import DjangoFilterBackend
|
||||
from rest_framework import filters
|
||||
|
|
@ -136,11 +136,11 @@ class LabelListView(LabelFilterMixin, ListAPI):
|
|||
]
|
||||
|
||||
|
||||
@method_decorator(cache_page(5), name='dispatch')
|
||||
@method_decorator(cache_page(2), name='dispatch')
|
||||
class LabelPrintMixin(LabelFilterMixin):
|
||||
"""Mixin for printing labels."""
|
||||
|
||||
@method_decorator(never_cache)
|
||||
@method_decorator(cache_page(1))
|
||||
def dispatch(self, *args, **kwargs):
|
||||
"""Prevent caching when printing report templates"""
|
||||
return super().dispatch(*args, **kwargs)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from django.template.exceptions import TemplateDoesNotExist
|
|||
from django.urls import include, path, re_path
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.decorators.cache import cache_page, never_cache
|
||||
from django.views.decorators.cache import cache_page
|
||||
|
||||
from django_filters.rest_framework import DjangoFilterBackend
|
||||
from rest_framework import filters
|
||||
|
|
@ -140,11 +140,11 @@ class ReportFilterMixin:
|
|||
return queryset
|
||||
|
||||
|
||||
@method_decorator(cache_page(5), name='dispatch')
|
||||
@method_decorator(cache_page(1), name='dispatch')
|
||||
class ReportPrintMixin:
|
||||
"""Mixin for printing reports."""
|
||||
|
||||
@method_decorator(never_cache)
|
||||
@method_decorator(cache_page(1))
|
||||
def dispatch(self, *args, **kwargs):
|
||||
"""Prevent caching when printing report templates"""
|
||||
return super().dispatch(*args, **kwargs)
|
||||
|
|
|
|||
Loading…
Reference in New Issue