checks for parent if given enough path bits, version bump

This commit is contained in:
Justin Quick 2010-06-16 11:06:15 -04:00
parent c3f2f2fc00
commit 09b1cda4b5
2 changed files with 8 additions and 2 deletions

View file

@ -1,7 +1,7 @@
__version_info__ = {
'major': 0,
'minor': 4,
'micro': 4,
'micro': 5,
'releaselevel': 'final',
'serial': 0
}

View file

@ -10,7 +10,13 @@ from settings import CACHE_VIEW_LENGTH
def category_detail(request, path, with_stories=False,
template_name='categories/category_detail.html', extra_context={}):
path_items = path.strip('/').split('/')
category = get_object_or_404(Category,
if len(path_items) >= 2:
category = get_object_or_404(Category,
slug__iexact = path_items[-1],
level = len(path_items)-1,
parent__slug__iexact=path_items[-2])
else:
category = get_object_or_404(Category,
slug__iexact = path_items[-1],
level = len(path_items)-1)