- return render_to_response('catalogue/catalogue.html', locals(),
- context_instance=RequestContext(request))
+ if request.is_ajax():
+ render_tag_list = lambda x: render_to_string(
+ 'catalogue/tag_list.html', tag_list(x))
+ output = {'theme': render_tag_list(fragment_tags)}
+ for category, tags in categories.items():
+ output[category] = render_tag_list(tags)
+ return JSONResponse(output)
+ else:
+ return render_to_response('catalogue/catalogue.html', locals(),
+ context_instance=RequestContext(request))