mirror of
https://github.com/jazzband/django-categories.git
synced 2026-03-16 22:30:24 +00:00
Added a caching setting to vary the amount of time the view is cached
This commit is contained in:
parent
4700b268eb
commit
b0468cc8e4
2 changed files with 5 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
@ -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('/')
|
||||
|
|
|
|||
Loading…
Reference in a new issue