diff --git a/categories/settings.py b/categories/settings.py index 9888bb9..1c812ac 100644 --- a/categories/settings.py +++ b/categories/settings.py @@ -1,3 +1,5 @@ from django.conf import settings -ALLOW_SLUG_CHANGE = getattr(settings, 'CATEGORIES_ALLOW_SLUG_CHANGE', False) \ No newline at end of file +ALLOW_SLUG_CHANGE = getattr(settings, 'CATEGORIES_ALLOW_SLUG_CHANGE', False) + +CACHE_VIEW_LENGTH = getattr(settings, 'CATEGORIES_CACHE_VIEW_LENGTH', 3600) \ No newline at end of file diff --git a/categories/views.py b/categories/views.py index 1f06885..c681f05 100644 --- a/categories/views.py +++ b/categories/views.py @@ -4,8 +4,9 @@ from django.http import HttpResponse from django.views.decorators.cache import cache_page from django.template.loader import select_template from categories.models import Category +from settings import CACHE_VIEW_LENGTH -@cache_page(3600) +@cache_page(CACHE_VIEW_LENGTH) def category_detail(request, path, with_stories=False, template_name='categories/category_detail.html'): path_items = path.strip('/').split('/')