Skip to content

Commit

Permalink
tiered template heirarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
justquick committed Feb 26, 2010
1 parent 06d3352 commit 30ad968
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions categories/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ def category_detail(request, path, with_stories=False,
category = get_object_or_404(Category,
slug__iexact = path_items[-1],
level = len(path_items)-1)
template = select_template((
'categories/%s.html' % '_'.join(path_items),
template_name,
))

templates = []
while path_items:
templates.append('categories/%s.html' % '_'.join(path_items))
path_items.pop()
templates.append(template_name)

context = RequestContext(request)
context.update({'category':category})
return HttpResponse(template.render(context))
return HttpResponse(select_template(templates).render(context))

0 comments on commit 30ad968

Please sign in to comment.