Added a caching setting to vary the amount of time the view is cached

This commit is contained in:
Corey Oordt 2010-04-05 13:09:02 -04:00
parent 4700b268eb
commit b0468cc8e4
2 changed files with 5 additions and 2 deletions

View file

@ -1,3 +1,5 @@
from django.conf import settings
ALLOW_SLUG_CHANGE = getattr(settings, 'CATEGORIES_ALLOW_SLUG_CHANGE', False)
ALLOW_SLUG_CHANGE = getattr(settings, 'CATEGORIES_ALLOW_SLUG_CHANGE', False)
CACHE_VIEW_LENGTH = getattr(settings, 'CATEGORIES_CACHE_VIEW_LENGTH', 3600)

View file

@ -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('/')