mirror of
https://github.com/jazzband/django-categories.git
synced 2026-03-16 22:30:24 +00:00
checks for parent if given enough path bits, version bump
This commit is contained in:
parent
c3f2f2fc00
commit
09b1cda4b5
2 changed files with 8 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
__version_info__ = {
|
||||
'major': 0,
|
||||
'minor': 4,
|
||||
'micro': 4,
|
||||
'micro': 5,
|
||||
'releaselevel': 'final',
|
||||
'serial': 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue